Remove post data on category page except post title

Community Forums Forums General Discussion Remove post data on category page except post title

This topic is: resolved

This topic contains 3 replies, has 2 voices, and was last updated by  Jen Baumann 2 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3682

    Marco
    Participant
    Post count: 4

    I want to remove all post data from the category pages so i only have the post titles left.

    The problem with this code is it also removes content from normal pages like my “contact”page and gravityforms don’t show up.

    /** remove post data on category page except post title **/
    remove_action(‘genesis_after_post_content’, ‘genesis_post_meta’);
    remove_action(‘genesis_before_post_content’, ‘genesis_post_info’);
    remove_action(‘genesis_post_content’, ‘genesis_do_post_content’);

    add_action(‘template_redirect’, ‘child_conditional_actions’);
    function child_conditional_actions() {
    if( is_single() ) {
    add_action(‘genesis_after_post_content’, ‘genesis_post_meta’);
    add_action(‘genesis_post_content’, ‘genesis_do_post_content’);
    }}

    How can i get my content back on normal pages like “contact” etc.?


    Where to find me: Facebook | Google + | Twitter | Website

    • This topic was modified 2 years ago by  Marco.
    • This topic was modified 2 years ago by  Marco.
    #3769

    Jen Baumann
    Keymaster
    Post count: 444

    You actually need to use this code in the reverse.  Put your remove actions within the conditional. If you are just trying to do this on the category pages, then your conditional is is_category().  More on conditionals: http://codex.wordpress.org/Conditional_Tags


    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.

    #3841

    Marco
    Participant
    Post count: 4

    This code worked for me:

    add_action(‘template_redirect’, ‘child_conditional_actions’);
    function child_conditional_actions() {
    if ( is_category()) {
    remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );
    remove_action( ‘genesis_after_post_content’, ‘genesis_post_meta’ );
    remove_action( ‘genesis_post_content’, ‘genesis_do_post_content’ );
    }}

    Thanks for pointing out Jen!


    Where to find me: Facebook | Google + | Twitter | Website

    #3846

    Jen Baumann
    Keymaster
    Post count: 444

    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 4 posts - 1 through 4 (of 4 total)

The topic ‘Remove post data on category page except post title’ is closed to new replies.