WordPress.org

Support

Support » Plugins and Hacks » how to? Display Sidebar item in specific pages only

how to? Display Sidebar item in specific pages only

  • hi everyone,

    I recently found out that I need to show specific paragraphs in specific pages of my blog in the sidebar. Some in individual post pages and some in wordpress static pages. If there a plugin to do this? or should I be using if…else to achieve this?

    thanks for looking, awaiting your valuable input on this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • you should be using conditionals (if..else)

    check this out: http://codex.wordpress.org/Conditional_Tags

    hi Ivovic,

    thanks for the tip.

    if (is_page('About')) {
                 // our about page.
                 echo "<p>Paragraph to be displayed in About me page</p>";
            } elseif (is_page('Colophon')) {
                 echo "<p>Paragraph to be displayed in Colophon page</p>";
            } else {
                  // catch-all for other pages
                  echo "<p>Vote for Pedro!</p>";
            }

    I think this is the code, I am only a beginner in PHP. Can anyone tell me if this will achieve the desired effect i want.

    I want my homepage, a static page and 2 single posts to show 4 different paragraphs with the heading “Also See:” on the sidebar….anyone got more ideas? 😀

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to? Display Sidebar item in specific pages only’ is closed to new replies.
Skip to toolbar