Adding pagination links
-
Hi – I’m trying to insert this pagination code from the blog…
<!--BEGIN .navigation .page-navigation --> <div class="navigation page-navigation"> <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?> <div class="nav-next"><?php next_posts_link(__('← Older Entries', 'framework')) ?></div> <div class="nav-previous"><?php previous_posts_link(__('Newer Entries →', 'framework')) ?></div> <?php } ?> <!--END .navigation .page-navigation --> </div> <?php else : ?> <!--BEGIN #post-0--> <div id="post-0" <?php post_class(); ?>> <h2 class="entry-title"><?php _e('Error 404 - Not Found', 'framework') ?></h2> <!--BEGIN .entry-content--> <div class="entry-content"> <p><?php _e("Sorry, but you are looking for something that isn't here.", "framework") ?></p> <!--END .entry-content--> </div> <!--END #post-0--> </div> <?php endif; ?> <!--END #primary .hfeed-->Into this page that pulls in custom posts. But I’m not sure how this is done. Could anyone be kind enough to shed some light…?
<?php /* Template Name: Case Studies */ ?> <?php get_header(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <!--BEGIN .portfolio-sidebar --> <?php ?> <?php endwhile; endif; ?> <?php $query = new WP_Query(); $query->query('post_type=case-studies&posts_per_page=6'); ?> <!--BEGIN #primary .hfeed--> <div class="hfeed"> <!--BEGIN #columns-wrap--> <ul> <?php $count = 1; ?> <?php $odd_or_even = 'odd'; ?> <?php if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); $terms = get_the_terms( get_the_ID(), 'skill-type' ); ?> <li data-id="id-<?php echo $count; ?>" class="<?php if($terms) : foreach ($terms as $term) { echo 'term-'.$term->term_id.' '; } endif; ?> <?php echo $odd_or_even; ?>"> <?php if ('odd' == $odd_or_even){ $odd_or_even = 'even'; }else{ $odd_or_even = 'odd'; } ?> <!--BEGIN .hentry --> <div <?php post_class(); ?> id="post-<?php the_ID(); ?>"> <?php /* if the post has a WP 2.9+ Thumbnail */ if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { ?> <div class="post-thumb"> <a title="<?php printf(__('Permanent Link to %s', 'framework'), get_the_title()); ?>" href="<?php the_permalink(); ?>"><?php the_post_thumbnail('case-study'); /* post thumbnail settings configured in functions.php */ ?></a> </div> <?php } ?> <div class="entry-wrapper"><h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'framework'), get_the_title()); ?>"> <?php the_title(); ?></a> <?php edit_post_link( __('edit', 'framework'), '<span class="edit-post">[', ']</span>' ); ?></h2> <!--BEGIN .entry-content --> <div class="entry-content"> <?php the_excerpt(); ?> <a href="<?php the_permalink(); ?>" class="more-link"><?php _e('Read more...', 'framework'); ?></a> <!--END .entry-content --> </div> </div> <!--END .hentry--> </div> </li><hr /> <?php $count++; ?> <?php endwhile; endif; ?> <?php wp_reset_query(); ?> <!--END #one-columns--> </ul> <!--END #portfolio-wrap--> </div> <?php get_footer(); ?>Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Adding pagination links’ is closed to new replies.