Pagination shows same content / randomize portfolio view
-
Hi,
I’ve been trying to get pagination to work in my custom theme, but can’t seem to figure it out. I searched forums and basically tried everything that fixes it for other people but still no succes for me. I mean it shows and all, but all the pages show the same content
Here’s my template code:
<?php /* Template Name: Portfolio */ get_header(); query_posts('post_type=portfolio&posts_per_page=9'); ?> <div id="portfolio" class="group"> <h1><?php the_title(); ?></h1> <div class="group"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php $title= str_ireplace('"', '', trim(get_the_title())); $desc= str_ireplace('"', '', trim(get_the_content())); ?> <div class="item"> <div class="img"><?php the_post_thumbnail(); ?></div> <p><strong><?=$title?></strong> <?php print get_the_excerpt(); ?><br><?php $site= get_post_custom_values('projLink'); if($site[0] != ""){ ?><a href="<?=$site[0]?>" target="_blank">(Visit website)</a><?php }else{ ?>No website<?php } ?></p> </div> <?php endwhile; ?> <nav class="pagination"> <?php pagination_bar(); ?> </nav> <?php else : ?> <!-- No posts found --> <?php endif; ?> </div> </div> <?php get_footer(); ?>
This is in my functions.php:
function pagination_bar() { global $wp_query; $total_pages = $wp_query->max_num_pages; if ($total_pages > 1){ $current_page = max(1, get_query_var('paged')); echo paginate_links(array( 'base' => get_pagenum_link(1) . '%_%', 'format' => '/page/%#%', 'current' => $current_page, 'total' => $total_pages, )); } }
Also I’m trying to show the portfolio items randomly.. No succes either 🙁
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Pagination shows same content / randomize portfolio view’ is closed to new replies.