• 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

Pagination on Homepage (Index Page) with Foodie Pro Theme

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 › General Discussion › Pagination on Homepage (Index Page) with Foodie Pro Theme

This topic is: resolved

Tagged: FoodiePro, genesis, navigation, pagination

  • This topic has 4 replies, 3 voices, and was last updated 7 years, 1 month ago by [email protected].
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • September 12, 2016 at 9:54 am #193021
    [email protected]
    Member

    Hi I'm using Genesis with the Foodie Pro theme. How can I add pagination to the homepage?

    September 12, 2016 at 4:53 pm #193047
    Brad Dalton
    Participant

    There is no loop on the front page so nothing to paginate.

    What you could do is add a link to a text widget

    Or

    Add a loop with 1 post and pagination.


    Tutorials for StudioPress Themes.

    September 12, 2016 at 5:08 pm #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();
    September 21, 2016 at 2:06 pm #193489
    gigtime
    Participant

    I tried that code mod in front-page.php of the Metro theme. It added pagination just fine. The problem was it didn't actually do anything. It just took me to 'page 2' which was the same as the home page. And page 3, etc. It also didn't do pagination in the same format as the rest of the theme like the blog pages. It was just plain text. I'm going to keep experimenting.

    October 10, 2016 at 10:20 pm #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();
    
  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Pagination on Homepage (Index Page) with Foodie Pro Theme’ is closed to new 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