How to add category name in 'post info'

Community Forums Forums Design Tips and Tricks How to add category name in 'post info'

This topic is: not resolved

This topic contains 6 replies, has 3 voices, and was last updated by  Ritesh Verma 9 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #83061

    Ritesh Verma
    Member
    Post count: 9

    Hi Guys,

    I need a bit of help regarding ‘post info’.

    Presently my post info stands as : Date, author, comments (December 7, 2013 by Ritesh Verma 2 Comments)

    i wish to add category as well to it. like :<date> by <author> in <category> <comments>. It just need to be category name here rather then showing whole lot of string attachs with it like ‘posted in : <category name>

    i tried a few snippets available on studioPress (SP) and other freely available resource on net. Unfortunately worked as per my goal. What closest i went was using shortcode present in simple edits plugin.
    <date> by <author>
    posted in <category>
    <comment> (edit)

    Eg : December 7, 2013 by Ritesh Verma
    Posted in : SEO
    2 Comments (Edit)

    i need all this in 1 line without any other text explanatory text attached with it. like [December 7, 2013 by Ritesh Verma in SEO 2 Comments

    http://studypep.com/
    #83088

    braddalton
    Participant
    Post count: 10202
    #83093

    Ritesh Verma
    Member
    Post count: 9

    Thanks Brad,

    I have already tried ‘your’ codes of wpsites before i post this question here. what i expect is removal of “filed under” present before category name and place category name right beside author name in same line.

    You can check the image to know what i am expecting to happen and what’s really going on.

    http://s11.postimg.org/4qne04sj7/Untitled7.jpg

    #83138

    braddalton
    Participant
    Post count: 10202

    The solution is in the post i linked to.

    Remove what you need from the filter including Filed under and add what you want and it will modify the default output in your post info or meta.

    Please note: Using PHP code with a filter that is already included in a plugin like Genesis Simple Edits may not work so try de-activating the plugin if you have it installed.


    #83155

    Ritesh Verma
    Member
    Post count: 9

    May be brad i am going wrong some where. This is what i have pasted from your site.

    remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    add_filter( 'genesis_post_info', 'sp_post_info_filter', 12 );
    function sp_post_info_filter($post_info) {
    $post_info = '[post_date] by [post_author_posts_link] in [post_categories] [post_comments] [post_edit]';
    return $post_info;
    }
    #86321

    sandy018
    Member
    Post count: 1

    I have same issue can anyone please explain.

    #86386

    Ritesh Verma
    Member
    Post count: 9

    Hello Sandy,

    After searching all resource available on net, I don’t think its possible what we are expecting. Every webmaster have shared one & the same thing; although few came up with different approaches to do it but end product is not satisfactory.

    Following resource available on net we will get :

    Date : XX/XX/XXXX By: Author
    Category : XXXXXX
    Leave a comment.

    Where as it should be like : <b>Date : XX/XX/XXX By XXXXXX In <category name>. Leave comment (Edit).<b>

    So sandy either you can use codes i pasted above; but will have all info in 3 different line or let it be in default setting if you want them to accommodate in one single line itself.

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

You must be logged in to reply to this topic.