WordPress.org

Ready to get started?Download WordPress

Forums

Sidebar removal on single page not working (3 posts)

  1. SmalliSax
    Member
    Posted 2 months ago #

    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.

  2. Pioneer Valley Web Design
    Member
    Posted 2 months ago #

    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.

  3. Jivani Bharat
    Member
    Posted 2 months ago #

    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' )

Reply

You must log in to post.

About this Topic