Community Forums › Forums › Archived Forums › General Discussion › Show author byline on some categories
- This topic has 13 replies, 4 voices, and was last updated 11 years, 5 months ago by
democracychronicles.
-
AuthorPosts
-
May 1, 2013 at 12:45 pm #38796
Josh Fialkoff
MemberHi,
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.orgMay 1, 2013 at 1:00 pm #38800Brad Dalton
ParticipantYou 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/
May 1, 2013 at 1:04 pm #38803Josh Fialkoff
MemberHi 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!
May 1, 2013 at 1:07 pm #38805Brad Dalton
ParticipantYou'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
!in_category
check the Codex
You would use this code in a custom function with the conditional tag:
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
May 1, 2013 at 1:08 pm #38806Josh Fialkoff
MemberAwesome! Thanks so much for your help.
May 2, 2013 at 7:20 am #38910Brad Dalton
ParticipantCould you please reply me with the categories you want excluded. thanks
May 2, 2013 at 7:40 am #38911Josh Fialkoff
MemberThanks. We did it already. We actually just want to *include* the Blog category.
May 2, 2013 at 7:41 am #38912Josh Fialkoff
MemberWe 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>May 2, 2013 at 8:24 am #38917Brad Dalton
ParticipantAugust 11, 2014 at 7:33 pm #118314democracychronicles
MemberHi 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.comAugust 11, 2014 at 9:04 pm #118319Brad Dalton
ParticipantUse the in_category(array( your comma separated cat i.d's here) conditional http://wpsites.net/web-design/modify-post-info-genesis/
August 12, 2014 at 1:30 am #118343johndu
Memberthanx @braddalton
August 12, 2014 at 1:31 am #118344johndu
MemberAugust 28, 2014 at 4:51 pm #121582democracychronicles
MemberThank 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;
}
} -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.