WordPress.org

Support

Support » How-To and Troubleshooting » Sidebar removal on single page not working

Sidebar removal on single page not working

  • Is it overall possible to take the sidebar out of a page that is not even published yet but only saved as a draft?

    That´s at least what I am trying to do with the webpage and I’ve searched so many forum posts for different php code to exclude sidebar from only this draft page with the specific id of 600 as it is now.

    In the Editor I have a php page called sidebar.php where I can find this line:

    <ul class="sidebar">
      <?php wp_list_pages('include=234,237,239,241,243,309&title_li=<h2>' . __('More info about X') . '</h2>' ); ?>
      </ul>

    It makes no difference though what so ever if I add the page id of the newly created draft page I have and add it in there or leave it out.

    I have also tried adding conditional statement to my page like this:

    <?php
      if (is_draft_page()) {
      } else {
        get_sidebar();
      }
    ?>

    But makes no difference what so ever, I really need to get rid of that sidebar while I am working on this particular page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • It is my experienced opinion (based on the information provided), none of your included code has anything to do with the issue at hand (hence why your edits do not work).

    Please provide a live site link that demonstrates the issue at hand. With that we can likely point you to resources that can be useful.

    hi…

    you can below condition to check i hope to use full

    post_status is part of the $post object which you can use to determine if it is published, a draft, pending, etc.

    if( $post->post_status == ‘pending’ )

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sidebar removal on single page not working’ is closed to new replies.
Skip to toolbar