WordPress.org

Ready to get started?Download WordPress

Forums

how to? Display Sidebar item in specific pages only (3 posts)

  1. theanand
    Member
    Posted 6 years ago #

    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.

  2. Ivovic
    Member
    Posted 6 years ago #

    you should be using conditionals (if..else)

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

  3. theanand
    Member
    Posted 6 years ago #

    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? :D

Topic Closed

This topic has been closed to new replies.

About this Topic