Category foreach Paging
I'm using the following code to display categories on my homepage, what I'd like to do is add the ability for paging with previous and next links, I haven't been able to figure out how to do this with a foreach
can anyone point me in the right direction?
Original Code:
?php
$cat = get_cat_ID("Photos");
$categories = get_categories("child_of=$cat");
?
?php if (is_array($categories) count($categories) 0) : ?
?php foreach ($categories as $category) { ?
?php query_posts("cat=$category-cat_IDorderby=randposts_per_page=1"); ?
?php while (have_posts()) : the_post(); ?
a href="?php bloginfo('url'); ??cat=?php echo $category-cat_ID; ?"?php the_post_thumbnail("gallery-thumb"); ?/a
?php endwhile; ?
?php wp_reset_query(); ?
?php query_posts("cat=$category-cat_IDorderby=nameposts_per_page=1"); ?
h3a href="?php bloginfo('url'); ??cat=?php echo $category-cat_ID; ?"?php single_cat_title(); ?/a/h3
?php wp_reset_query(); ?
?php $query = $category-count; ?
?php if ($query == 1) $query .= " Image"; else $query .=" Images"; echo 'p class="center"('.$query.')/p'; //Album Count ?
?php } ?
?php else : ?
pI hate to break it to you...but right now there are strongno albums available/strong for viewing, please try again later./p
?php endif; ?
Code Update:
?php
$parent = get_cat_ID("Photos");
$cats = get_categories("child_of=$parent");
?
?php foreach ($cats as $cat) { ?
?php echo $cat-name; ?
?php $query = $cat-count; ?
?php if ($query == 1) $query .= " Image"; else $query .=" Images"; echo 'p class="center"('.$query.')/p'; //Album Count ?
?php } ?
Thanks,
Josh
Topic next previous php categories pagination Wordpress
Category Web