Search the Community
Showing results for tags 'wpquery'.
-
So, here goes... On my website, http://jamaica2go.com, I have destinations laid out in thumbnails on the main destination page. The page is using three columns. The page works fine as it is, however, I know that as I add more locations scrolling will become an issue. The author did a great job on this theme and he also gave an option to select maximum number of items to be shown but no paging occurs once you hit that max (weird, right?). I have tried, I really have. Reading up on the WP codex, hunting down scripts and tutorials, all with a view to adding this simple feature. I know if someone figures this out it's going to be easy as cheese but the drawback for me is that I'm not a PHP programmer, just pretty decent at editing and changing the code. Anyway, I'm posting the entire page code below (realised at end that I can attach, so did that instead). The important stuff happens in the "uxbarn_custom_port_load_portfolio_shortcode" function and onward. I noticed that although he starts a while loop to write the thumbnails to the page, he doesn't seem to end it. He also has a pagination template for the blog page which I'll add below but I couldn't make heads or tails of it. Hope someone can assist. PORTFOLIO PAGE ------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------ The template below is used for blog and search and is called with: <?php get_template_part( 'template-pagination' ); ?> PAGINATION TEMPLATE ------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------ <?php $big = 999999999; global $wp_query; $total_pages = $wp_query->max_num_pages; if( is_search() ) { // Only for search page, there are 10 posts per page // And always round up the result $total_pages = ceil( $wp_query->found_posts / 10 ); } if ( $total_pages > 1 ) { echo '<div class="row no-margin-bottom"> <div id="blog-pagination" class="uxb-col large-12 columns pagination-centered"> '; $current_page = max( 1, get_query_var( 'paged' ) ); echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '&page=%#%', 'current' => $current_page, 'total' => $total_pages, 'prev_text' => '<i class="icon ion-ios7-arrow-left"></i>', 'next_text' => '<i class="icon ion-ios7-arrow-right"></i>', 'type' => 'list' )); echo '</div> </div>'; } ?> ------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------ custom-uxbarn-portfolio.php template-pagination.php
- 1 reply
-
- nopaging
- pagination
-
(and 3 more)
Tagged with: