WordPress.org

Ready to get started?Download WordPress

Forums

Exclude a Page from query post function (2 posts)

  1. wireframe74
    Member
    Posted 4 years ago #

    Hi I have a query post function that is grabbing child pages for a gallery that I have set up here: Gallery

    I really want to exclude a page from the 2nd loop on page as I have 2 loops running and an image is repeating itself in gallery..

    I have initial loop with a limit of one to grab the initial image from gallery and the second one which is in a hidden div which retrieves all images.

    I have looked at codex but it mentions info on how to exclude categories and not pages..I have tried appending this to my query post to achieve this with no luck 'page_id=-45'

    Below are my two loops

    <p>To view our gallery of exciting Roplay products,
    please  <?php
    query_posts(array('showposts' => 1, 'post_parent'=> 40, 'post_type' => 'page'));
    while (have_posts()) {
    the_post();
    ?>
    <a href="<? echo get('gallery_image'); ?>" rel="lightbox-gallery" title="<?php the_title(); ?>" id="gallery">click here...</a>
    
    <?php }
    
    wp_reset_query(); //Restore Global Post data
    
    ?>
    
    <?php
    query_posts(array('showposts' => 100, 'post_parent'=> 40, 'post_type' => 'page','page_id=-45'));
    while (have_posts()) {
    the_post();
    ?>
     <div style="display:none;"><a href="<? echo get('gallery_image'); ?>" rel="lightbox-gallery" title="<?php the_title(); ?>">click here...</a></div>
    
    <?php }
    
    wp_reset_query(); //Restore Global Post data
    
    ?>
    
    <?php
    query_posts(array('showposts' => 100, 'post_parent'=> 40, 'post_type' => 'page','p=-45'));
    while (have_posts()) {
    the_post();
    ?>
  2. Shane G.
    Member
    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.