How to give paged,pagination to the custom terms?
-
I created a function for custom temrs,tags and a page to dislyay these terms,so I also created a taxonomy-myterm.php wich working very good everything is fine.
I get the list of created custom terms in the page and I get all the posts of any term.Because I attached to the wordpress posts.But the problem is with the pagination.
I allways resolved things alone but this time I need your help.this is the page template wich I display all my custom terms:
<?php /* Template Name: Template Performers */ get_header(); ?> <div class="mainw"><div class="main l170"> <h2><?php _e('Performers List', 'mythemename'); ?></h2> <div class="clear"></div> <div class="clear"></div> <?php foreach (get_terms('performer') as $cat) : ?> <div class="item"> <div class="photo-thumb"> <a href="<?php echo get_term_link($cat->slug, 'performer'); ?>"> <img width="220" height="290" src="<?php echo z_taxonomy_image_url($cat->term_id,NULL, array(220, 290)); ?>" /> </a></div> <h2 class="thumb-title"> <a href="<?php echo get_term_link($cat->slug, 'performer'); ?>"> <p><?php echo $cat->name; ?><br /> Total Posts <?php $catcount = $cat->count; echo $catcount; ?> </p> <div class="clear"></div> </div> <?php endforeach; ?> </div> </div> <?php get_sidebar(); get_footer(); ?>
as I said the template works fine,I get all the list of the terms with images using a plugin.
But now I’m looking to give a page per post number (paged) to give to the terms any pagination maybe numeric or alphabetic but first as first I cant make the template to display a specific number for page.
I tried this one:
<?php /* Template Name: Template Performers */ get_header(); ?> <?php if ( get_query_var( 'paged' ) ) $paged = get_query_var('paged'); else if ( get_query_var( 'page' ) ) $paged = get_query_var( 'page' ); else $paged = 1; $per_page = 1; $total_terms = 12; // This needs to be the total number of series (count the number of terms in the series with a function) $offset = $per_page * ( $paged – 1) ; // Setup the arguments to pass in $args = array( 'order' => 'ASC', 'offset' => $offset, ); // Gather the series $performerlist = get_terms( 'performer', $args ); ?> <div class="mainw"><div class="main l170"> <h2><?php _e('Performers List', 'mythemename'); ?></h2> <div class="clear"></div> <div class="clear"></div> <?php foreach $performerlist as $cat) : ?> <div class="item"> <div class="photo-thumb"> <a href=”<?php echo get_term_link($cat->slug, 'performer'); ?>"> <img width="220" height="290" src="<?php echo z_taxonomy_image_url($cat->term_id,NULL, array(220, 290)); ?>" /> </a></div> <h2 class="thumb-title"> <a href=”<?php echo get_term_link($cat->slug, 'performer'); ?>"> <p><?php echo $cat->name; ?><br /> Total Videos <?php $catcount = $cat->count; echo $catcount; ?> </p> <div class="clear"></div> </div> <?php endforeach; ?> </div> </div> <?php get_sidebar(); get_footer(); ?>
But didnt work ?? I didnt find any solution I dont know where I’m wrokng but I thought that maybe I can find the solution here thankyou!
in advance
- The topic ‘How to give paged,pagination to the custom terms?’ is closed to new replies.