• Hi everyone,

    I’m using the Motion theme and I’m trying to limit which pages are to be displayed under the “pages” menu. Does anyone know how to do this?

    This is the actual code pulling the pages:
    <div class=”foot2″>

      <?php if ( !function_exists( ‘dynamic_sidebar’ ) || !dynamic_sidebar( ‘footer_middle’ ) ) : ?>
    • <h3>Confidential Site</h3>
      <?php wp_list_pages( ‘title_li=’ ); ?>

    <?php endif; ?>

    </div>

Viewing 3 replies - 1 through 3 (of 3 total)
  • You should be able to exclude the visibility of pages from the menu by modifying wp_list_pages .

    Some reference material for the wp_list_pages function:

    Exclude Pages from List

    Doesn’t the private publication option cover your requirements? It really depends on how ‘excluded’ you want your pages to be.

    ClaytonJames’s solution will work if you want the posts to be public but not linked on the sidebar. If you want complete privacy for the excluded pages, publish them as private posts.

    Another way to achieve ClaytonJames’s solution with a less hard-coded method would be to add a custom field value such as “Include in Sidebar” and add this to the wp_list_pages parameters via meta_key. That way, ONLY pages in which a value for that key is ascribed will show in the sidebar.

    John

    Well put, SpankMarvin. You’ve taken into account a lot of facts not yet evidenced by additional communication from the OP, but many good possibilities for consideration there.

    @j4q0

    I’m trying to limit which pages are to be displayed under the “pages” menu

    You may need to make the distinction between “visible” and “private” before deciding on a solution.


    “You should be able to exclude the visibility of pages…”

    As stated, my solution simply excludes visibility of the pages you decide you don’t want listed in the menu. Very quick, very easy, and involves the code you posted. But it has nothing to do with making them “private” if that is your intent.

    Good luck to you! 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Limit which pages are pulled by php’ is closed to new replies.