Conditional After Post Content

Community Forums Forums General Discussion Conditional After Post Content

This topic is: not resolved

This topic contains 6 replies, has 4 voices, and was last updated by  surefirewebserv 2 years, 7 months ago.

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


    For after the post content (Where you can input email to subscribe), is it possible to show different content based on the post or post category? I want after post content A to appear for category A and after post content B to appear for category B.

    Can someone give me a sample code as to how to make it work?

    Thank you in advance.





    I did not understand the following part.

    include( ‘path/to/pwdc.html’ );
    include( ‘path/to/genesis.html’ );

    I am trying to add mailchimp subscribe code (Different subscribe code for different categories). Should I include it in a particular file and call it?

    Thank you,.



    Brian Gardner has a this – for adding an After Post Widget that you can use.



    Hi Anitac,

    I am current using that code on my site. It’s working fine. My requirement is to show different such code based on the page people come to. E.g: A post about web design should display my web design list from mailchimp. An article about marketing should display the lead capture for my marketing list from mailchimp.



    For that, I’d recommend using the Dynamic Widgets plugin,

    I’m currently using it on several sites, and it’s very easy to control which widgets are displayed on categories, pages, etc.

    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark




    You can either add the code to a page or add the code to your functions file. You would replace the include paths to your new html file that you made, or you can replace the include with the actual code.

    add_action( ‘genesis_after_post_content’,’sf_affiliate_block’ );
    * Add affiliate box template to end of single post.
    * If post is in Better Web Design category (190), use a different template.
    * @since 1.0.0
    * @author Sure Fire Web Services
    * @link
    * @return Return null if not a single post.
    function sf_affiliate_block() {
    if ( ! is_single() )

    if ( in_category( ‘190’ ) ) // if in the category with an id of 190
    // echo ‘your new code’ or include your file
    // echo ‘a different code’ or include your file

    I use this same exact code to add my after post files. If you go on my site, anything that has to do with genesis (or is in the genesis category) will get a “built on genesis” block of text after the post, while every other post with get a “learn web design” block of text.

    Bottom line, there are multiple ways to handle this. The plugins will definitely work, (another plugin recommendation would be simple sidebars) or you can code it directly into the functions.php file. They all work. | Genesis Tuts and More
    Genesis Theme Starter Kit | It’s Free

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

You must be logged in to reply to this topic.