- This topic has 4 replies, 3 voices, and was last updated 7 years, 1 month ago by .
- The topic ‘Pagination on Homepage (Index Page) with Foodie Pro Theme’ is closed to new replies.
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.
Hi I'm using Genesis with the Foodie Pro theme. How can I add pagination to the homepage?
There is no loop on the front page so nothing to paginate.
What you could do is add a link to a text widget
Add a loop with 1 post and pagination.
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();
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.
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();
© 2023 WPEngine, Inc.