Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter theapehouse

    (@theapehouse)

    As above

    Thread Starter theapehouse

    (@theapehouse)

    Brilliant, thanks! Still getting the hang of filters.

    Pasting the whole code here in case it helps someone else:

    /* THIS CHANGES FEATURED IMAGE TO 'Mug Shot' ON PAGES OF CUSTOM POST TYPE 'plc_person', ADDS A DESCRIPTION AND MOVES THE METABOX TO IMMEDIATELY UNDER THE MAIN CONTENT */
    
    /* Put the meta box setup function on the post editor screen. */
    add_action( 'load-post.php', 'plc_person_meta_boxes_setup' );
    add_action( 'load-post-new.php', 'plc_person_meta_boxes_setup' );
    /* Meta box setup function. */
    function plc_person_meta_boxes_setup() {
    
      /* Change featured image meta box */
      add_action('do_meta_boxes', 'change_featured_image_box');
    }
    /* To be displayed on the person editor screen. */
    function change_featured_image_box() {
    	remove_meta_box( 'postimagediv', 'plc_person', 'side' );
    	add_meta_box('postimagediv', __('Mug Shot'), 'post_thumbnail_meta_box', 'plc_person', 'normal', 'high' );
    }
    
    /* Display post thumbnail meta box including description */
    add_filter( 'admin_post_thumbnail_html', 'plc_post_thumbnail_add_description', 10, 2 );
    
    function plc_post_thumbnail_add_description( $content, $post_id ){
    $post = get_post( $post_id );
    $post_type = $post->post_type;
        if ( $post_type = plc_person) {
      		$content .= "<p><label for=\"html\">This needs to be a head shot of this person stood in front of the wall in the hall. Crop to 300px x 300px with half a brick above and below their head.</label></p>";
    		return $content;
    		return $post_id;
    	}
    }
    
    /* Rename 'Featured Image' as 'Mug Shot' */
    function plc_person_change_labels($labels) {
    	$labels->featured_image  = 'Mug Shot';
        $labels->set_featured_image  = 'Add Mug Shot';
        $labels->remove_featured_image   = 'Remove Mug Shot';
        $labels->use_featured_image  = 'Use as Mug Shot';
    
    	return $labels;
    }
    /* This is the filter being applied in wp-includes>post.php */
    /* $labels = apply_filters( "post_type_labels_{$post_type}", $labels ); */
    
    add_filter( "post_type_labels_plc_person", 'plc_person_change_labels', 10, 1 );
    Thread Starter theapehouse

    (@theapehouse)

    Thanks that’s great – I’m almost there. Code is:

    add_filter( 'admin_post_thumbnail_html', 'plc_post_thumbnail_add_description' );
    
    function plc_post_thumbnail_add_description( $content, $post_id ){
    $post = get_post( $post_id );
    $post_type = $post->post_type;
        if ( $post_type = plc_person) {
      		$content .= "<p><label for=\"html\">This needs to be a head shot of this person stood in front of the wall in the hall. Crop to 300px x 300px with half a brick above and below their head.</label></p>";
    		return $content;
    		return $post_id;
    	}
    }

    It works, but I have an error message:
    Warning: Missing argument 2 for plc_post_thumbnail_add_description() in D:\Sites\penistoneleisurecentre.org.uk\public_html\wp-content\themes\modern-portfolio-pro\includes\plc-person.php on line 166

    Do you know what is wrong?
    Thanks a lot

    Thread Starter theapehouse

    (@theapehouse)

    I’ve got it sorted, thanks. Not related to my original problem

    Thread Starter theapehouse

    (@theapehouse)

    Thanks a lot Buzztone, my forms have now appeared back on my website, just as they should be.

    I now can’t get back into the dashboard, though. I get:

    Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 393216 bytes) in D:\Sites\ourhogwatch.org.uk\public_html\wp-admin\menu.php on line 267

    I’ve looked at menu.php and all there is on line 267 is );

    Immediately before it is:

    ‘// ensure we’re backwards compatible
    $compat = array(
    ‘index’ => ‘dashboard’,
    ‘edit’ => ‘posts’,
    ‘post’ => ‘posts’,
    ‘upload’ => ‘media’,
    ‘link-manager’ => ‘links’,
    ‘edit-pages’ => ‘pages’,
    ‘page’ => ‘pages’,
    ‘edit-comments’ => ‘comments’,
    ‘options-general’ => ‘settings’,
    ‘themes’ => ‘appearance’,’

    so it seems to be closing the brackets correctly.

    Any suggestions? Thanks,
    Rachel

    Thread Starter theapehouse

    (@theapehouse)

    I’ve put your points here: https://ww.wp.xz.cn/support/topic/theme-gridiculous-custom-menu-wizard-plugin-issues?replies=2#post-6095628

    Hopefully the Gridiculous authors will pick it up

    Thanks again,
    Rachel

    Thread Starter theapehouse

    (@theapehouse)

    The plugin author has since added this post:

    You may wish to convey this to the theme authors (or bring this forum thread to their notice) :

    I believe that all they would need to do is add an extra condition to the first line of their bavotasan_nav_menu_args() function, such that…

    if ( 1 !== $args[ ‘depth’ ] && has_nav_menu( ‘primary’ ) )

    becomes…

    if ( 1 !== $args[ ‘depth’ ] && has_nav_menu( ‘primary’ ) && ‘primary’ == $args[ ‘theme_location’ ] )

    This works for me; it restricts their customised Walker to the one specific location that their theme provides, and leaves all other menus, including any CMW instance, alone. Just a thought.

    Thread Starter theapehouse

    (@theapehouse)

    Thanks for all your efforts on this, wizzud.

    I did look into making a child theme awhile ago, but the instructions I found only said what to do if you’re using a theme that does not use wp_enqueue_style() in its functions.php file. But gridiculous does, and I couldn’t get the child theme to work.

    I just don’t think I could do the other things you suggest and be sure I wasn’t wrecking things.

    I will email the authors of Gridiculous and see what they say.

    Thanks a lot, the app is great and the support you provide even better!

    Rachel

    Thread Starter theapehouse

    (@theapehouse)

    Thsnks a lot for getting back to me.

    I’m using WordPress 4.0 running Gridiculous theme.

    Activated plugins:
    Admin menu editor
    Contact form 7
    Contact form DB
    Enhanced text widget
    Event list calendar
    Jetpack
    Profile builder
    WP Google maps

    I don’t have any inactive plugins

    Thanks,
    Rachel

Viewing 9 replies - 1 through 9 (of 9 total)