Forums

Adding content in sidebar only on certain pages (3 posts)

  1. jannmirch
    Member
    Posted 2 years ago #

    I have looked all over for a snippet or something, but no luck.

    I've successfully added a second sidebar on all pages unrelated to the blog (pardon me if I'm getting my terminology mixed up.)

    I now want to add text in this sidebar but ONLY on our "products" pages.

    I've added the text but now it's showing up on all the pages.

    URL: http://rdadaptiveapparel.com/products/

    The code I'm using in the Text widget in the sidebar:

    <?php if (is_page('products')) { ?>
    <h1>Stay Tuned: Cool Clothes for Toes is the first in a growing line of fun easy-on styles of adaptive clothing and accessories.</h1>
    <?php } else { ?>
    <p> </p>
    <?php } ?>

    Any help is appreciated!

  2. stvwlf
    Member
    Posted 2 years ago #

    Hi

    The text widget does not allow the entry of PHP code in it. Your code is there but its being treated as text and not executed. Thus the text appears on all pages as its not being filtered out by the PHP code.

    Install the PHP Code Widget http://wordpress.org/extend/plugins/php-code-widget/

    Enter the exact same code in it as you have in the text widget and it should work fine.

  3. jannmirch
    Member
    Posted 2 years ago #

    You are a GOD! Thank you. I knew it had to be something simple I was overlooking.

Topic Closed

This topic has been closed to new replies.

About this Topic