Pagenavi plug-in is not working in Custom Post Types
-
I’ve implemented Custom Post Types in my theme (twentyten) functions and created post templates using single.php (template is called single-events.php) and installed pagenavi plugin.
The pagenavi appears but only says “Page 1 of 1” and there is over 20 post type items….
here is the post types code:
add_action(‘init’, ‘events’);
function events() {
$args = array(
‘label’ => __(‘Events’),
‘singular_label’ => __(‘Events’),
‘public’ => true,
‘show_ui’ => true,
‘capability_type’ => ‘post’,
‘hierarchical’ => false,
‘rewrite’ => true,
‘supports’ => array(‘title’, ‘editor’, ‘thumbnail’, ‘custom-fields’)
);register_post_type( ‘events’ , $args );
}And in the post template I’ve added:
<?php
/*
Template Name Posts: single-events
*/
?><?php include (TEMPLATEPATH . ‘/header_home.php’); ?>
<div id=”container”>
<div id=”content” role=”main”>
<?php
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
$loop = new WP_Query( array(
‘post_type’ => ‘getting-started’,
‘posts_per_page’ => 9,
‘orderby’=> ‘menu_order’,
‘paged’=>$paged
) ); ?><?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
<?php if ( is_front_page() ) { ?><h2 class=”entry-title”><?php the_title(); ?></h2>
<?php } else { ?><h1 class=”entry-title”>getting started | <?php the_title(); ?></h1>
<?php } ?>
<div class=”entry-content”>
<?php the_content(); ?>
<?php wp_link_pages( array( ‘before’ => ‘<div class=”page-link”>’ . __( ‘Pages:’, ‘twentyten’ ), ‘after’ => ‘</div>’ ) ); ?>
<?php edit_post_link( __( ‘Edit’, ‘twentyten’ ), ‘<span class=”edit-link”>’, ‘</span>’ ); ?></div><!– .entry-content –>
</div><!– #post-## –>
<?php comments_template( ”, true ); ?><div style=”width:170px; margin-left:385px; top:670px; float:left: z-index:1000; position:absolute;”><table><tr><td><span style=”text-decoration: none;font-family:Helvetica Neue,Arial,Helvetica,san-serif;color:#7572a6;font-weight:bold; font-size:11px;”>getting started </span></td><td><span style=”text-decoration: none;font-family:Helvetica Neue,Arial,Helvetica,san-serif;color:#7572a6;font-weight:bold; font-size:11px;”>|</span></td><td><?php wp_pagenavi(); wp_reset_query(); ?></td></tr></table></div>
<?php endwhile; ?>
<!– #content –>
</div><!– #container –>
<div id=”instructions”>page instructions ||</div>
<?php include (TEMPLATEPATH . ‘/sidebar_getting_started.php’); ?></div>
<?php get_footer(); ?>
My php is intermediate… I reaaly need help here! thnx!!
- The topic ‘Pagenavi plug-in is not working in Custom Post Types’ is closed to new replies.