• 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

Add pagination in archive template

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 › Add pagination in archive template

This topic is: not resolved
  • This topic has 3 replies, 2 voices, and was last updated 7 years, 8 months ago by Guinnessboy.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • February 20, 2018 at 10:57 am #216816
    Guinnessboy
    Member

    Hi there
    I created an archive template for a cpt but i don't know what i have to add to get pagination.
    Actually i juste have the 12 first items and i can't see the others.

    <?php
    /**
     * Template Name: Restaurant Archives
     * Description: Display results for restaurant CPT archive
     */
    remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
    add_action( 'genesis_loop', 'custom_do_grid_loop' ); // Add custom loop
    function custom_do_grid_loop() {  
    ?>  	
    <div class="entry">
    <?php
    	// Intro Text (from page content)
    	$args = array(
    		'post_type' => 'restaurant', // enter your custom post type
    		'orderby' => 'menu_order',
    		'order' => 'ASC',
    		'posts_per_page'=> '12',  // overrides posts per page in theme settings
    	);
    	$loop = new WP_Query( $args );
    	if( $loop->have_posts() ):
    				
    		while( $loop->have_posts() ): $loop->the_post(); global $post;
    		?>
    			<div class="archive-cadre">
    <-- Content displayed here -->
    			</div>		
    		<?php		
    		endwhile;
    	endif;
    	
    ?>
    </div>	
    <?php
    }
    	
    remove_action('genesis_before_post_content','genesis_post_info');
    remove_action('genesis_after_post_content','genesis_post_meta');
     
    genesis();

    Thanks for your help.

    https://douarnenezenvie.bzh/restaurant/
    February 20, 2018 at 8:46 pm #216842
    ᴅᴀᴠɪᴅ
    Member

    You'd need to add the 'paged' argument to the WP_Query. It's not a Genesis specific question, it's a WordPress question. See the WordPress codex for more on the Pagination parameters.

    Is there a reason you created a new template to show to the archive template? You can just add 'has_archive’ => true,' when you register the CPT, and the archive page will automatically be created, with pagination.


    I love helping creative entrepreneurs build epic things with WP & Genesis.

    Follow on Twitter

    February 20, 2018 at 8:48 pm #216843
    ᴅᴀᴠɪᴅ
    Member

    You'd need to add the 'paged' argument to the WP_Query.

    See the WordPress codex for more on the Pagination parameters.

    Is there a reason you created a new template to show to the archive template? You can just add 'has_archive’ => true,' when you register the CPT, and the archive page will automatically be created, with pagination.


    I love helping creative entrepreneurs build epic things with WP & Genesis.

    Follow on Twitter

    March 6, 2018 at 6:25 pm #217375
    Guinnessboy
    Member

    Hi and thanks David.
    Unfortunately don't get reply notification.

    I need custom page to display CPT and custom fields created with ACF.

    https://douarnenezenvie.bzh/restaurant/

  • 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

© 2025 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