WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Sub pages: custom sidebar (5 posts)

  1. sha12sha
    Member
    Posted 10 months ago #

    Hi,

    I have a theme with a sidebar for every kind of page, tag and categories. Now I have sub pages and I have put this code in the sidebar.php

    <?php if(is_page('2190')){ ?>

    But nothing is shown in the subpage. I have search and I have found another solutions, like

    <?php if($post->post_parent ='2190'){ ?>

    Then I can see the custom sidebar in the subpage and I have two sidebars in the rest of the blog: the original for every tag, category and pages, and at the end of this one, the custom sidebar of the subpage... Any idea? Thanks!

  2. alchymyth
    The Sweeper & Moderator
    Posted 10 months ago #

    try to put the two into one and correct the comparison operator:

    <?php if( is_page(2190) || $post->post_parent == 2190 ){ ?>

  3. sha12sha
    Member
    Posted 10 months ago #

    Thanks for the help alchymyth!

    The sidebar still is empty :(

  4. alchymyth
    The Sweeper & Moderator
    Posted 10 months ago #

    does the sidebar show for the page directly?

    possibly try to add global $post; before the if

    please post the full code of sidebar.php

  5. sha12sha
    Member
    Posted 10 months ago #

    Hi,

    I made a new sidebar only for this page, as people recommended in this topic:

    http://wordpress.org/support/topic/sidebar-per-page?replies=23

    And it works!

Reply

You must log in to post.

About this Topic

Tags

No tags yet.