• Hi everyone.
    Quoted below is my theme’s sidebar code.
    At the bottom you can see the code for a series of images.
    How do I exclude this section of code for certain pages so the images appear only on certain pages?
    Any help is really appreciated. Thanks!

    (I know i can paste the code into a widget and use various available plugins but I dont want my sidebar block colouring behinnd the images)

    [Large code removed by moderator. Please use the Pastebin.]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Per forum rules, please use the Pastebin to share large chunks of code. Besides, it works better anyway.

    http://wordpress.pastebin.com/

    A good solution is using the plugin Ts-Custom-Widgets.

    You include those images on a widget, and then you select which pages, posts you want to show that widget, and which posts pages, you want to avoid the widget.

    Good luck,
    Alex.

    You can use is_page()
    http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page

    Something like:

    <?php
    if ( is_page('about') || is_page('gallery') ) {
        // display photos
    } else {
        // do something other than display photos
    }
    ?>

    Thread Starter dban_2_3

    (@dban_2_3)

    Hi guys, thanks for your responses.

    The code with the images on each page is here. As you can see, at the bottom are the images which appear in the sidebar of each page.
    How do I get these images only to show on certain pages such as ‘welcome’ and ‘sponsors’?

    jrav001
    I’ve given your code a shot and to my frustration I can’t get it to work. My attempt is here which gives the following error:

    Parse error: syntax error, unexpected ‘<‘ in /home/beckford/public_html/wp-content/themes/reiss9/sidebar1.php on line 122

    Thanks,
    Dan.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How exclude sidebar code from certain pages’ is closed to new replies.