• Resolved andrewlilley

    (@andrewlilley)


    I need to access a particular page only through linking to it from code in header.php. This page must not be shown in the automatic page listing (though I need the other pages listed) created by index.php.

    The reason for this is that if the page is navigated to from index.php, the Jquery code displays this page’s contents in a sliding box, which is too small for the page’s content.

    I’ve created a custom template for that page, preventing the content from opening in the Jquery sliding box.

    Making the page Private doesn’t work as it’s not accessible from the header.php link.

    Are there any solutions to this?

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Use the exclude= argument with the template tag, wp_list_pages().

    Related:
    wp_page_menu()
    Function_Reference/get_pages

    Thread Starter andrewlilley

    (@andrewlilley)

    Thanks, but the pages aren’t listed using wp_list_pages(). This is the code:

    <ul class=”navigation”>
    <?php while (have_posts()) : the_post(); ?>

    After this:

    <?php while (have_posts()) : the_post(); ?>

    put

    if (! '34' == $post->ID) (

    and just before:

    <?php endwhile;?>
    put

    }
    `

    But there might be some other code just before the code you listed that would make it easier (like a get_posts where you could use the post__not_in argument).

    Thread Starter andrewlilley

    (@andrewlilley)

    I can’t get it working. See the navigation directly above the white box: https://andrewlilley.com/surveydeck/

    BTW, did you mean to put a ‘{‘ in your code instead of a ‘(‘? This still doesn’t work.

    The original code I have is:

    <?php get_header(); ?>
    <?php query_posts('post_type=page&order=asc'); ?>		
    
    <div id="page">
    	<div id="slider">
    		<ul class="navigation">
    <?php while (have_posts()) : the_post(); ?>
    			<li><a href="#<?=$post->post_name?>"><span><?php the_title(); ?></span></a></li>
    <?php endwhile;?>
    		</ul>
    
    		<div class="scrollButtons scrollMeLeft"><a><span>previous</span></a></div>
    
    		<div class="scroll">
    			<div class="scrollContainer">
    <?php while (have_posts()) : the_post(); ?>
    				<div class="panel" id="<?=$post->post_name?>">
    					<h3><?php the_title(); ?></h3>
    					<?php the_content(); ?>
    				</div>
    <?php endwhile;?>
    			</div>
    		</div>
    
    		<div class="scrollButtons scrollMeRight"><a><span>next</span></a></div>
    
    	</div>
    </div>
    
    <?php get_footer(); ?>

    Alternately, you could create the page as normal. Then go to the page, and click “View page source”. Copy the entire thing and save it as whatever you want the title to be. Upload that file to your server directly using ftp. Then delete the page in wordpress.

    This might be better.

    Change

    <?php query_posts('post_type=page&order=asc'); ?>

    to

    <?php
    $args=array(
          'post__not_in' => array(1,2,3),
          'post_type' => 'page',
          'order' => 'ASC',
          'orderby' => 'title'
        );
     query_posts($args);
    ?>

    and forget what I put in the previous comments…

    Thread Starter andrewlilley

    (@andrewlilley)

    Thanks Michael, that worked! Great help!

    Brian, thanks, but maybe that wouldn’t have worked – the page contains a forum plugin… ?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Preventing a page being shown in the page list’ is closed to new replies.