• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Custom Page Template Help

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Custom Page Template Help

This topic is: resolved

Tagged: category template, custom page template

  • This topic has 3 replies, 2 voices, and was last updated 8 years, 3 months ago by creative5designs.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • December 12, 2014 at 9:15 am #134373
    creative5designs
    Member

    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 #134521
    creative5designs
    Member

    Anyone 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 #134546
    Brad Dalton
    Participant

    You 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.


    Tutorials for StudioPress Themes.

    December 14, 2014 at 10:44 pm #134548
    creative5designs
    Member

    Thanks 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.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble