Style post content for a category

Community Forums Forums Design Tips and Tricks Style post content for a category

This topic is: resolved

This topic contains 4 replies, has 2 voices, and was last updated by  sheilab 2 years, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #21829


    How would I go about adding a div inside the content of single posts of a particular category?

    Can I do this from the functions.php file?




    Sridhar Katakam

    1) (Not mandatory, but will make this easy) Install and activate Genesis Simple Hooks plugin.

    2) Go to Genesis -> Simple Hooks -> genesis_after_post_content Hook (Reference)


    <?php if(is_single() && in_category( ‘Cat A’ )) { ?> <div id="my-custom-div">Hello hello.</div> <?php } ?>

    Change ‘Cat A’ to the name of your desired category and the div’s content of course.

    Tick ‘Execute PHP on this hook?’.



    Thanks for this! I now understand how to use Genesis Simple Hooks. Very useful. Unfortunately it turns out not to be what I need in this particular case.

    What I need is to format a category of single posts with a short-code initiated slideshow and a block of descriptive text sitting to its right.  The slide show and text need to be centered on the page. My client will be adding links etc to the descriptive text so it has to be added from the post editor.

    Can you tell me the best way to go about this?

    Thanks again! Sheila






    Sridhar Katakam

    Are all posts going to be like that or only some?

    Do you want two custom fields, one for slideshow shortcode and the other for corresponding text?

    Yesterday I made a post regarding showing value of a custom field above the content area that you might find useful. See



    Thank you!

    Your custom field post was very valuable. I installed ACF and drawing from you code I was able to use Simple Hooks to display the fields.

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

You must be logged in to reply to this topic.