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

  1. sha12sha
    Posted 1 year ago #


    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. try to put the two into one and correct the comparison operator:

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

  3. sha12sha
    Posted 1 year ago #

    Thanks for the help alchymyth!

    The sidebar still is empty :(

  4. 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
    Posted 1 year ago #


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


    And it works!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.