Community Forums › Forums › Archived Forums › General Discussion › Pagination on Homepage (Index Page) with Foodie Pro Theme
Tagged: FoodiePro, genesis, navigation, pagination
- This topic has 4 replies, 3 voices, and was last updated 9 years, 4 months ago by
[email protected].
-
AuthorPosts
-
September 12, 2016 at 9:54 am #193021
[email protected]
MemberHi I'm using Genesis with the Foodie Pro theme. How can I add pagination to the homepage?
September 12, 2016 at 4:53 pm #193047Brad Dalton
ParticipantThere 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.
September 12, 2016 at 5:08 pm #193049[email protected]
MemberI 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 #193489gigtime
ParticipantI 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]
MemberMy 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(); -
AuthorPosts
- The topic ‘Pagination on Homepage (Index Page) with Foodie Pro Theme’ is closed to new replies.