Show author byline on some categories

Community Forums Forums General Discussion Show author byline on some categories

This topic is: not resolved

Tagged: , ,

This topic contains 13 replies, has 4 voices, and was last updated by  democracychronicles 2 weeks, 5 days ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #38796

    Josh Fialkoff
    Participant
    Post count: 22

    Hi,

    How can I add a filter to show the author byline on just some categories?

    For instance, I want to show the byline on blog posts, but not on news category posts.

    Thanks,

    Josh

    http://www.wlfarm.org
    #38800

    braddalton
    Participant
    Post count: 9734

    You can use either CSS to hide it or a remove action with conditional tags including the page/post i.d’s you want to remove it from. http://my.studiopress.com/snippets/post-info/


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #38803

    Josh Fialkoff
    Participant
    Post count: 22

    Hi Brad,

    Thanks for your quick reply.

    I don’t see information on this page about how to filter by category.

    Please let me know what I am missing…

    Thanks for your help!

    #38805

    braddalton
    Participant
    Post count: 9734

    You’ll need to modify the code or use CSS. I have written about this in a couple of posts so I can provide the code tomorrow.

    The conditional tag to filter by category is [php]!in_category[/php] check the Codex

    You would use this code in a custom function with the conditional tag:
    [php]remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );
    [/php]


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #38806

    Josh Fialkoff
    Participant
    Post count: 22

    Awesome! Thanks so much for your help.

    #38910

    braddalton
    Participant
    Post count: 9734

    Could you please reply me with the categories you want excluded. thanks


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #38911

    Josh Fialkoff
    Participant
    Post count: 22

    Thanks. We did it already. We actually just want to *include* the Blog category.

    #38912

    Josh Fialkoff
    Participant
    Post count: 22

    We added this to the Simple Hooks plugin:

    <?php
    if(in_category(‘blog’ ))
    ?>
    <div class=”post-info”>
    <?php
    if(in_category(‘blog’ ))
    echo’
    <span class=”time”>’;?><?php if(in_category(‘blog’ )) the_time(‘F j, Y’); ?></span> <span class=”author”>

    <?php if(in_category(‘blog’ ))
    echo’by ‘; if(in_category(‘blog’ )) the_author(); ?></span>
    </div>

    #38917

    braddalton
    Participant
    Post count: 9734

    Good stuff.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #118314

    democracychronicles
    Member
    Post count: 14

    Hi I have the same problem,

    How can I add a filter to show the author byline on just some categories? Is there CSS that can accomplish this? I don’t use Genesis Simple Edits plugin. I would like to only show the byline for one category:

    http://www.democracychronicles.com/category/blogs/

    Thanks,

    Adrian
    democracychronicles.com

    #118319

    braddalton
    Participant
    Post count: 9734

    Use the in_category(array( your comma separated cat i.d’s here) conditional http://wpsites.net/web-design/modify-post-info-genesis/


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #118343

    johndu
    Member
    Post count: 2

    thanx @braddalton

    #118344

    johndu
    Member
    Post count: 2

    #121582

    democracychronicles
    Member
    Post count: 14

    Thank you for your wonderful help and sorry I took so long!. I fixed the problem by adding this to my functions.php

    add_filter( ‘genesis_post_info’, ‘remove_post_info_exclude_news_category’ );
    function remove_post_info_exclude_news_category($post_info) {
    if ( in_category(‘blogs’) ) {
    $post_info = ‘[post_date] by [post_author_posts_link] [post_edit]‘;
    return $post_info;
    }
    }

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

You must be logged in to reply to this topic.