Conditional remove_action of post-info…

Community Forums Forums Design Tips and Tricks Conditional remove_action of post-info…

This topic is: not resolved

This topic contains 5 replies, has 2 voices, and was last updated by  Jen Baumann 1 year, 4 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1969

    mattspaeth
    Participant
    Post count: 11

    I am trying to remove post-info from the display of a single post. This is what I came up with, but it doesn’t work. Am I using the wrong hook in the add_action?

    add_action( 'genesis_before_post_content', 'single_conditional_actions' );
    function single_conditional_actions() {
     if ( is_single() ) {
     remove_action( 'genesis_before_post_content', 'genesis_post_info' );
     }
     }
    #1981

    Jen Baumann
    Keymaster
    Post count: 315

    You need to add your action earlier. Try one of these:
    add_action( 'genesis_before', 'single_conditional_actions' );
    add_action( 'template_redirect', 'single_conditional_actions' );


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

    #1988

    mattspaeth
    Participant
    Post count: 11

    Thanks Jen, I tried both of your suggestions and it’s not working. Is there anything that can conflict with these? The only other additions are a remove_action and an add_action which places post-info above the titles on the home page.

    remove_action( 'genesis_before_post_content', 'genesis_post_info' );
    add_action( 'genesis_before_post_title', 'genesis_post_info' );

    #1990

    Jen Baumann
    Keymaster
    Post count: 315

    Since you’ve removed it from genesis_before_post_content, you’ll need to make your remove action:

    remove_action( 'genesis_before_post_title', 'genesis_post_info' );


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

    #2648

    mattspaeth
    Participant
    Post count: 11

    Thank you Jen, that worked great.

    #2673

    Jen Baumann
    Keymaster
    Post count: 315

    You’re welcome!


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

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

The topic ‘Conditional remove_action of post-info…’ is closed to new replies.