Forum Replies Created

Viewing 15 replies - 16 through 30 (of 855 total)
  • Plugin Author David Gard

    (@duck_boy)

    DavidGMiles, please accept my apologies for not answering your question, I clearly missed the notification of it.

    I can imagine situations where waiting for the Admin Bar to disappear on it’s own could be annoying. A valid idea, and something I’d be willing to look at.

    Where I would place the button is the main issue, but please allow me to look in to it and I’ll update you of my progress in due course.

    Thread Starter David Gard

    (@duck_boy)

    Ok, I finally figured this out; it was all because the encoding of the readme.txt file was incorrect.

    I recreated the file as an ANSI file and it’s now being read correctly.

    Thread Starter David Gard

    (@duck_boy)

    Ah, never mind, I’ve just figured it out completely by accident!

    It seems that you must have uploaded at least one image via Appearance -> Headers for the section to appear in Appearance -> Customise. As I was using a default from my theme and had no uploaded images, the section was hidden.

    Thanks for you time though, help is always appreciated.

    Thread Starter David Gard

    (@duck_boy)

    Of course. I also include the action/function to add theme support for custom headers in this file, but I’ve not duplicated it as it is posted in my original question.

    Thanks.

    /**
     * Add the JS for the live preview
     */
    add_action('customize_preview_init', 'customiser_live_preview');
    function customiser_live_preview(){
    	wp_enqueue_script('theme-customiser', get_template_directory_uri().'/admin/js/customise.js', array( 'jquery','customize-preview' ), '', true);
    }
    
    /**
     * Add custom controls to the theme customiser
     */
    add_action('customize_register', 'register_costomisation_controls');
    function register_costomisation_controls($wp_customize){
    
    	$wp_customize->add_section('footer_section' , array(
    		'title'		=> __('Footer', 'dd_theme'),
    		'priority'	=> 1010
    	));
    
    	$wp_customize->add_setting('footer_background_colour' ,array(
    		'default'	=> '#CFCFCF',
    		'transport'	=> 'postMessage'
    	));
    	$wp_customize->add_setting('footer_text' ,array(
    		'default'	=> '',
    		'transport'	=> 'refresh'
    	));
    
    	$wp_customize->add_control(
    		new WP_Customize_Color_Control(
    			$wp_customize,
    			'footer_background_colour',
    			array(
    				'label'		=> __('Background Colour', 'dd_theme'),
    				'section'	=> 'footer_section',
    				'settings'	=> 'footer_background_colour'
    			)
    		)
    	);
    	$wp_customize->add_control(
    		new Customize_Textarea_Control(
    			$wp_customize,
    			'footer_text',
    			array(
    				'label'		=> __('Text', 'dd_theme'),
    				'section'	=> 'footer_section',
    				'settings'	=> 'footer_text'
    			)
    		)
    	);
    
    }
    
    /**
     * Output the relevant styles for customised settings in the header
     */
    add_action('wp_head', 'output_costomisation_css');
    function output_costomisation_css(){
    ?>
    	<style type="text/css">
    		#footer-full-width{
    			background-color: <?php echo get_theme_mod('footer_background_colour'); ?>;
    		}
    	</style>
    <?php
    }
    
    /**
     * Custom control class for including a textarea in the theme customiser
     */
    if(class_exists('WP_Customize_Control')){
    class Customize_Textarea_Control extends WP_Customize_Control{
    
        public $type = 'textarea';
    
        public function render_content(){
    ?>
    		<label>
    			<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
    			<textarea rows="5" style="width:100%;" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>
    		</label>
    <?php
    	}
    }
    }
    Thread Starter David Gard

    (@duck_boy)

    Yes it is, I just got too over-eager on my cutting! Will amend.

    I do add some of my own customisation settings, although none that use the header_image section, and I when I output $wp_customize I can see that the header_image setting is listed and includes my default image.

    It has the parameter [theme_supports] => custom-header, which has obviously been added as I get the page Appearance -> Header.

    Thanks.

    Thread Starter David Gard

    (@duck_boy)

    I had to properly add the containers that the Admin Bar uses, and viewing /wp-includes/admin-bar.php showed me what I needed to do.

    add_action('admin_bar_menu', 'on_admin_bar', 35);
    function on_admin_bar(){
    
    	global $wp_admin_bar, $wpdb;
    
    	if(!current_user_can('edit_charts') || !is_admin_bar_showing()) :
    		return;
    	endif;
    
    	/* Add the Admin Bar item */
    	$wp_admin_bar->add_menu(array(
    		'id' => 'charts',
    		'title' => '<span class="ab-icon"></span><span class="ab-label">'._x( 'Charts', 'admin bar menu group label' ).'</span>',
    		'href' => admin_url('/admin.php?page=charts'),
    		'meta'  => array(
    			'title' => __('Charts'),
    		)
    	));
    	if(current_user_can('create_charts')) :
    		$wp_admin_bar->add_menu(array(
    			'parent' => 'charts',
    			'id' => 'add-chart',
    			'title' => __('Add Chart'),
    			'href' => admin_url('/admin.php?page=add-chart')
    		));
    	endif;
    
    }

    And the CSS required is –

    #wp-admin-bar-charts .ab-icon:before{
    	font-family: "dashicons" !important;
    	content: "\f185" !important;
    }

    To find the number of the correct icon to use (to replace \f185), visit the Dashicons page, click the icon you want to use, and then click on Copy CSS at the top of the page.

    It would be like this –

    body.page-id-1 .wp-caption,
    body.page-id-2 .wp-caption,
    body.page-id-3 .wp-caption{
    position: relative;
        left: -90px;
    }

    Please ensure you wrap your code, it makes it easier to read.

    Thread Starter David Gard

    (@duck_boy)

    Never mind, turns out someone had added a .htaccess file to the wp-content directory that only allowed certain file types to be open (to prevent attempts to access things like *.php and *.js files).

    Once I added ‘docx’ and ‘doc’ to the list of allowed types, it worked fine.

    Thanks.

    Get yourself a tool called Firebug. This allows you to inspect your page, and you can work out what code needs to be removed/edited, and what CSS needs to be changed.

    Sounds like Wordfence has caused this issue.

    Try disabling the plugin, but if you cannot access your admin area, you may need to do this through the database. You need to access the wp_options table, and change the ‘active_plugins’ key. Take a copy of the content of the key first, just in case you make a mistake.

    Or, if you don’t want to mess with the database, you can rename the folder that contains the Wordfence plugin, and WP should automatically remove it from it’s active plugins list.

    Thread Starter David Gard

    (@duck_boy)

    This ensures that you don’t stomp unrelated WP_Query instances.

    Good point, have amended my code.

    Thanks for your help.

    Thread Starter David Gard

    (@duck_boy)

    And I have the answer.

    It was because when Posts are listed in the admin they are an Archive, so when filtering the correct post_type (‘person’, for my Custom Post Type) was being over-ridden by my hack, causing the Query to fail. I’ve replaced the hack with the below, and it seems to be working just fine.

    add_filter('posts_where', 'add_tla_to_archive');
    function add_tla_to_archive($where){
    
    	if(!is_admin() && is_archive() && !is_tax()) :
    
    		$where = str_replace("$wpdb->posts.post_type = 'post'", "$wpdb->posts.post_type IN ('".POST_TYPE_NEWS."', '".POST_TYPE_TLA."')", $where);
    	endif;
    
    	return $where;
    
    }

    Thanks.

    Thread Starter David Gard

    (@duck_boy)

    Ok, so I have found out what is going on.

    I have a small hack in wp-includes/query.php, allowing me to show two types of posts in an Archive.

    if(is_archive() && !is_tax()){
    	$post_type = array(
    		POST_TYPE_NEWS,
    		POST_TYPE_TLA
    	);
    }

    I’m not quite sure how yet (still investigating), but this was causing the query to screw up some how. I’ve had this hack for about 3 years and this is the first time I’ve run in to issues, so I will be working on a work-around asap.

    With regards to the 'admin_column' query_var, could I request a future enhancement to allow me to change the title that is displayed in the list table? Although it’s called Staff linked to this Story when I regester the connection type, I’d like for just Contacts to be used as the column title.

    Thanks.

    Thread Starter David Gard

    (@duck_boy)

    Have gone throught the chart, and with all other plugins deactivated and using the default theme, I’m still being told that no articles are found.

    Thanks.

    Thread Starter David Gard

    (@duck_boy)

    Thanks for the quick reply, but unfortunately it’s not working. I’m getting the extra admin column, but clicking the link returns no results.

    Here is an example of the link (which I’m sure is as it should be) –

    https://test.dynedrewett.com/wp-admin/edit.php?connected_type=news_to_people&connected_direction=to&connected_items=458&post_type=post

    Any ideas at all? Thanks.

    FYI, here is the full query that is created –

    SELECT SQL_CALC_FOUND_ROWS wp_posts.*, wp_p2p.*
    FROM wp_posts
    INNER JOIN wp_p2p
    WHERE 1=1
    AND wp_posts.post_type IN ('post', 'tla')
    AND (
    	wp_posts.post_status = 'publish'
    	OR wp_posts.post_status = 'future'
    	OR wp_posts.post_status = 'draft'
    	OR wp_posts.post_status = 'pending'
    	OR wp_posts.post_status = 'private'
    )
    AND (
    	wp_p2p.p2p_type = 'news_to_people'
    	AND wp_posts.ID = wp_p2p.p2p_from
    	AND wp_p2p.p2p_to IN (
    		SELECT wp_posts.ID
    		FROM wp_posts
    		WHERE 1=1
    		AND wp_posts.ID IN (458)
    		AND wp_posts.post_type IN ('post', 'tla')
    		AND (
    			wp_posts.post_status = 'publish'
    			OR wp_posts.post_status = 'future'
    			OR wp_posts.post_status = 'draft'
    			OR wp_posts.post_status = 'pending'
    			OR wp_posts.post_author = 3
    			AND wp_posts.post_status = 'private'
    		)
    		ORDER BY wp_posts.post_date DESC
    	)
    )
    ORDER BY wp_posts.post_date DESC
    LIMIT 0, 20
Viewing 15 replies - 16 through 30 (of 855 total)