Pagination of unordered lists on a standard page?
-
I hope I do an ok job explaining this.
Looking through my theme files, I can see that index.php, search.php, tags.php, categories.php, archive.php, and so on and so forth use the if(have_posts) code to bring up posts, and then there is a div with:
<?php if (function_exists("pagination")) { pagination($additional_loop->max_num_pages); } ?>
for the pagination. It shows 24 posts per page, and then starts a new one.
I’m wondering if there is a way to apply this same effect to an unordered list that I have on another page.
I have a chunk of code in a custom theme file (page-a.php) which displays all the terms starting with the same letter from one of my taxonomies as icons, similar to how they show up on my index, archive, and tag pages, etc :
<?php $terms = get_terms("character"); $count = count($terms); $letter = 'A'; if ( $count > 0 ){ $ul = "<ul>"; foreach ( $terms as $term ) { if ( preg_match("/^$letter/i",$term->name) ) { echo $ul; $ul = ''; // only display once echo '<li><div class="spacer"></div><a href="' . get_term_link($term) . '">'. $term->name . '</a> <a href="' . get_term_link($term) . '"><img src="/images/characters/A/'.$term->slug.'".jpg/></a></li>'; } } if ( $ul == '') { echo "</ul>"; } } ?>
As of right now, they are all showing up on one page. Often times there can be dozens, even hundreds of terms, and so I’d like it to create a new page according to the number set in the reading settings like it does with all the others pages. Twenty four results, then automatically create a new page for the next 24.
Is there any way to achieve this?
- The topic ‘Pagination of unordered lists on a standard page?’ is closed to new replies.