• The code below pulls in the specific articles from the category I want along with a specified amount. how do i pull the pagination below the articles? i have it set to display 4 but i am thinking there will be over 20 or so and it would be nice to cycle through instead of having a long list.

    <ul id="news">
    
    <?php $temp_query = $wp_query; ?>
    <?php query_posts("category_name='hot-off-the-plate'&showposts=4"); ?>
    <?php while (have_posts()) : the_post(); ?>
    
    <li>
    <div class="post" id="post-<?php the_ID(); ?>">
    
    <?php  $pdfLink = get_post_meta($post->ID, 'pdf_link', true);
    	if ( !empty($pdfLink) ) echo '' ?>
    
    <div class="pdf_download"><a href="<?php echo $pdfLink ?>" target="_blank"><img src="/wp-content/themes/blau/style/images/pdf_bttn.gif" width="41" height="37" alt="" /></a>
    </div>
    
    <div class="thmb">
    <?php the_post_thumbnail(); ?>
    </div>
    <?php the_title('<h4>', '</h4>'); ?>
    
    <p><strong> - </strong></p>
    <p><strong><?php the_time('F jS, Y') ?>, </strong></p>
    
    <?php the_excerpt(); ?>
    
    <!--<p><a href="<?php /*the_permalink();*/ ?>">Read Full Story >></a></p>-->
    
    </div>
    
    </li>
    
    <?php endwhile; ?>
    
    </ul>
Viewing 6 replies - 1 through 6 (of 6 total)
  • <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('category_name=hot-off-the-plate&posts_per_page=4&paged=' $paged); ?>

    Are you sure that category name is correct? That looks more like the category slug to me…

    Thread Starter kmaier

    (@kmaier)

    yes, you are right it pulls from the slug.

    i tried that code but i get an error: Parse error: syntax error, unexpected T_VARIABLE in /nfs/c07/h04/mnt/106463/domains/dev.elizabethblau.com/html/wp-content/themes/blau/page-hot-off-the-plate.php on line 58

    Sorry – I omitted a ‘.’:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('category_name=hot-off-the-plate&posts_per_page=4&paged=' .$paged); ?>

    However, I’m not sure you can pull posts based on the slug using category_name. Whilst it might work in the short term, that may change in later version of WP. You might be better off using:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('category_name=hot off the plate&posts_per_page=4&paged=' .$paged); ?>
    Thread Starter kmaier

    (@kmaier)

    ha whoa, it just seems to repeat the latest article over and over with each snippet. http://dev.elizabethblau.com/in-the-news/hot-off-the-plate/

    Thread Starter kmaier

    (@kmaier)

    got it. how do i get the nav to pull in for the other article posts?

    <ul id="news">
    
    <?php $temp_query = $wp_query; ?>
    
    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;							query_posts('category_name=hot off the plate&posts_per_page=4&paged=' .$paged); ?>
    
    <?php while (have_posts()) : the_post(); ?>
    <li>
    <div class="post" id="post-<?php the_ID(); ?>">
    
    <?php  $pdfLink = get_post_meta($post->ID, 'pdf_link', true);
    if ( !empty($pdfLink) ) echo '' ?>
    
    <div class="pdf_download">
    <a href="<?php echo $pdfLink ?>" target="_blank"><img src="/wp-content/themes/blau/style/images/pdf_bttn.gif" width="41" height="37" alt="" /></a>
    </div>
    
    <div class="thmb">
    <?php the_post_thumbnail(); ?>
    </div>
    
    <?php the_title('<h4>', '</h4>'); ?>
    
    <p><strong> - </strong></p>
    
    <p><strong><?php the_time('F jS, Y') ?>, </strong></p>
    
    <?php the_excerpt(); ?>
    
    </div>
    
    </li>
    
    <?php endwhile; ?>
    
    </ul>
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Pagination’ is closed to new replies.