• 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

[email protected]

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
  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • October 10, 2016 at 10:20 pm in reply to: Pagination on Homepage (Index Page) with Foodie Pro Theme #194486
    [email protected]
    Member

    My brain is fried, I'm really at a loss here. I get that there's no loop on front-page.php, okay so I have tried to create my own. I have all my widgets set to display a total 4 posts from category id 5 on the homepage. I want pagination links to go to a page that will show the next 4 pages and so on. How do I create a loop to do that. Right now it's just showing a listing of all my published posts when I click the next page link. Here's the end of my front-page.php

    	genesis_widget_area( 'home-bottom', array(
    		'before' => '<div class="widget-area home-bottom">',
    		'after'  => '</div> <!-- end .home-bottom --> <div class="pagination">' . paginate_links( array(
    				'prev_text'          => __('« Previous Page'),
    				'next_text'          => __('Next Page »')
    			) ) . '</div>'
    		
    	) );
    
    	// Based on https://gist.github.com/billerickson/3218052
    	global $post;
    	// arguments, adjust as needed
    	$args = array(
    				// 'post_type' => 'post',
    				'category' => '5',
    				'posts_per_page' => get_option( 'posts_per_page' ),
    				// 'post_status' => 'publish',
    				'paged' => get_query_var( 'paged' )
    			);
    
    	/*
    	Overwrite $wp_query with our new query.
    	The only reason we're doing this is so the pagination functions work,
    	since they use $wp_query. If pagination wasn't an issue,
    	use: https://gist.github.com/3218106
    	*/
    	
    	global $wp_query;
    	$wp_query = new WP_Query( $args );
    		 
    	if ( have_posts() ) :
    		while ( have_posts() ) : the_post();
    		endwhile;
    		
    		do_action( 'genesis_after_endwhile' );			
    	endif;
    
    	wp_reset_query();
    }
    
    genesis();
    
    September 12, 2016 at 5:08 pm in reply to: Pagination on Homepage (Index Page) with Foodie Pro Theme #193049
    [email protected]
    Member

    I figured it out. To the front-page.php file of the Foodie Pro theme I modified the last couple lines:

    	genesis_widget_area( 'home-bottom', array(
    		'before' => '<div class="widget-area home-bottom">',
    		'after'  => '</div> <!-- end .home-bottom -->' . paginate_links( array(
    				'prev_text'          => __('« Previous Page'),
    				'next_text'          => __('Next Page »')
    			) )
    		
    	) );
    }
    
    genesis();
  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)

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