• Hi guys,
    I’ve attempted to create a loop to display all the content in three pages (Web-Design, Illustration & Patterns) in to a page called View All. How ever it failed miserably, aka it didn’t actually do anything!

    In the three pages I have a custom field name set as ‘post type’ and the value to ‘portfolio’

    This is the coding I used –

    <?php query_posts('meta_key=post_type&meta_value=portfolio');  ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    		<h1><?php the_title(); ?></h1>
    
    			<div class="entry">
    
    				<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
    			</div>			            
    
        <?php endwhile; ?>

    Any idea’s how I can get a loop to display the content from those pages?

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php
    $args=array(
      'meta_key'=>'post_type',
      'meta_value'=> 'portfolio',
      'post_type' => 'page',
      'post_status' => 'publish',
      'posts_per_page' => -1,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
        <?php
      endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>
    Thread Starter srotherham

    (@srotherham)

    Ah! Brilliant that has more or less done the job, however the gallery items are no longer display in four columns, but one and the lightbox no longer works.

    This is how the page looks

    This is how one of the galleries should look

    Thank you very much for your help so far 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘The Loop for WordPress Pages’ is closed to new replies.