remove post info on custom post type

Community Forums Forums Design Tips and Tricks remove post info on custom post type

This topic is: not resolved

This topic contains 2 replies, has 3 voices, and was last updated by  Summer 6 months, 4 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #87112

    billmcq
    Participant
    Post count: 28

    I have researched several ways to try and do this, but none work for me. I am using a HTML genesis theme.
    I a using this code…but the custom post type for “condominiums” will not remove the date on the Custom Post.

    /** Remove custom Post Type post_info */
    add_action(‘template_redirect’, ‘remove_post_info_cpt’);
    function remove_post_info_cpt() {
    if ( ‘condominiums’ !== get_post_type())
    remove_action( ‘genesis_entry_header’, ‘genesis_post_info’ );
    }

    the name of the custom post type is verified as “condominiums”, so not sure why the date is still appearing on these posts under the post title. What am I doing wrong?

    #87153

    pxforti
    Participant
    Post count: 68

    I think you need to add priority to it:

    remove_action( ‘genesis_entry_header’, ‘genesis_post_info’, 12 );


    writeNowDesign
    WordPress and Ecommerce Website Design

    #87193

    Summer
    Participant
    Post count: 1009

    Actually, I think your conditional logic might be what’s hanging you up.

    What you have above is testing the post type, and if the post type is NOT condominiums, then remove the post info.

    What you should be using is:

    if (  ‘condominiums’ == get_post_type() )
       remove_action( ‘genesis_entry_header’, ‘genesis_post_info’ );
    }

    That way, if your post type tests “true” for “condominiums”, then it’ll perform the remove_action. The way you have it now, it’ll perform that remove_action for every post type except “condominiums”.


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.