• jannmirch

    (@jannmirch)


    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: https://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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • stvwlf

    (@stvwlf)

    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 https://www.ads-software.com/extend/plugins/php-code-widget/

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

    Thread Starter jannmirch

    (@jannmirch)

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding content in sidebar only on certain pages’ is closed to new replies.