Community Forums › Forums › Archived Forums › Design Tips and Tricks › Custom Page Template Help
Tagged: category template, custom page template
- This topic has 3 replies, 2 voices, and was last updated 10 years, 1 month ago by creative5designs.
-
AuthorPosts
-
December 12, 2014 at 9:15 am #134373creative5designsMember
I'm really hoping someone can help me with this - I've tried everything I can think to try and can't seem to find a solution that works anywhere.
I've set up a custom page template to run a custom loop on a client's site but can not get the pagination to work correctly. The code I'm using is
<?php //* Template Name: Blog //* Show page content above posts remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop add_action( 'genesis_loop', 'genesis_standard_loop', 5 ); // show the editor content add_action( 'genesis_before_loop', 'wpsites_before_blog_widget' ); function wpsites_before_blog_widget() { if( !is_paged() ) { genesis_widget_area( 'before-blog', array( 'before' => '<div class="before-blog widget-area">', 'after' => '</div>', )); } } add_action( 'genesis_loop', 'rgc_do_loop' ); // Add custom loop function rgc_do_loop() { global $post; // arguments, adjust as needed $args = wp_parse_args( genesis_get_custom_field( 'query_args' ), array( 'post_type' => 'post', 'posts_per_page' => 5, 'post_status' => 'publish', 'paged' => get_query_var( 'paged' ) ) ); global $wp_query; $wp_query = new WP_Query( $args ); if ( have_posts() ) : while ( have_posts() ) : the_post(); echo '<div class="pod">'; echo '<div class="entry-title"><h1><a href="' . get_permalink() . '"> ' . get_the_title() . ' </a> </h1></div>'; // show the title echo '<a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '">'; // Original Grid echo '</a>'; echo get_post_meta($post->ID, "podcast", true); echo '<div class="podmore"><a class="podmore" href="' . get_permalink() . '">Show Notes</a></div>'; // show notes link echo '</div>'; endwhile; do_action( 'genesis_after_endwhile' ); endif; wp_reset_query(); } genesis();
And the output is here: Podcast Page
Everything is displayed correctly, but the pagination is not working past page 2. There should be 4 pages there (currently, this will of course be expanded as they add more posts to the category) The pages do exist, for example page 3 can be found here, but there is not next page link after page 2.
I'm betting this is something simple, but I just can't wrap my head around the issue.
Anyone have any suggestions?
December 14, 2014 at 1:45 pm #134521creative5designsMemberAnyone have any ideas on this - or even suggestions as to another way I can achieve this layout for a category template?
I forgot to mention in my previous post that I'm using the Lifestyle Pro theme. Also, if I set the pagination to numerical, it's only showing 2 pages total - even though as mentioned the 3rd & 4th pages do exist when you type in the URLs.
December 14, 2014 at 10:34 pm #134546Brad DaltonParticipantYou don't use a template name for archives. You use the Template File Hierarchy and simply name the file category.php
That may not fix the pagination issue but may prevent other issues.
December 14, 2014 at 10:44 pm #134548creative5designsMemberThanks Brad. I'm using this as a category page for one of my categories (all other follow the standard layout), not archives.
I actually just found the issue and was coming to mark this as resolved when I saw your response. It turns out that for some reason on of my plug-ins wasn't playing nicely with this page (and others)
Rookie mistake, should have been the first thing I checked.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.