IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

How to Add Pagination on Genesis Lifestyle Theme Front Page

Genesis Lifestyle Pro Theme
As an update to their top seller Genesis Theme, StudioPress released a new Lifestyle Pro Theme with responsive design and HTML5. If you’re a member of My StudioPress, then you’ll have access to setup the theme exactly as it looks like in a demo, which is already very good to begin with.

I really like how the front page was setup, however I also want it to function as my main blog along with navigation links at the bottom of the content (see picture). Genesis standard loop is still going to be used for page two and beyond so they look like a normal blog page.

In order to achieve this, we need to modify the front-page.php file. The modification was based on the code from Bill Erickson for creating custom loop with pagination.

See the modified front-page.php below with all changes highlighted.

<?php
/**
 * This file adds the Home Page to the Lifestyle Pro Theme.
 *
 * @author StudioPress
 * @package Lifestyle Pro
 * @subpackage Customizations
 */

add_action( 'genesis_meta', 'lifestyle_home_genesis_meta' );
/**
 * Add widget support for homepage. If no widgets active, display the default loop.
 *
 */
function lifestyle_home_genesis_meta() {

	if ( !is_paged() ) {

		if ( is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-middle' ) || is_active_sidebar( 'home-bottom-left' ) || is_active_sidebar( 'home-bottom-right' ) ) {
	
			// Force content-sidebar layout setting
			add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
	
			// Add lifestyle-pro-home body class
			add_filter( 'body_class', 'lifestyle_body_class' );
	
			// Remove the default Genesis loop
			remove_action( 'genesis_loop', 'genesis_do_loop' );
	
			// Add homepage widgets
			add_action( 'genesis_loop', 'lifestyle_homepage_widgets' );

		}
	}
}

function lifestyle_body_class( $classes ) {

	$classes[] = 'lifestyle-pro-home';
	return $classes;
	
}

function lifestyle_homepage_widgets() {
	
	genesis_widget_area( 'home-top', array(
		'before' => '<div class="home-top widget-area">',
		'after'  => '</div>',
	) );
	
	genesis_widget_area( 'home-middle', array(
		'before' => '<div class="home-middle widget-area">',
		'after'  => '</div>',
	) );
	
	if ( is_active_sidebar( 'home-bottom-left' ) || is_active_sidebar( 'home-bottom-right' ) ) {

		echo '<div class="home-bottom">';

		genesis_widget_area( 'home-bottom-left', array(
			'before' => '<div class="home-bottom-left widget-area">',
			'after'  => '</div>',
		) );

		genesis_widget_area( 'home-bottom-right', array(
			'before' => '<div class="home-bottom-right widget-area">',
			'after'  => '</div>',
		) );
		
		echo '</div>';	
	}

	// Based on https://gist.github.com/billerickson/3218052
	global $post;
	// arguments, adjust as needed
	$args = array(
				'post_type' => 'post',
				'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();

The pagination on the front page should look like the picture below.

Genesis Lifestyle Pro Theme Custom Pagination

Lifestyle Pro is definitely worth checking out due to its capability as one of the modern responsive WordPress themes, its elegant look, and easy customization.

Caveat

You need to pay attention on the number posts to show on the Admin settings. Since the way it’s setup on the front page is showing 8 posts at a time, you need to make sure the setting is also for 8 posts at a time so the second page of the blog doesn’t skip any postings.

WordPress Admin Setup (Reading)

January 13, 2014 Filed Under: How To, WordPress Tagged With: Genesis Framework

Buy me a coffee?

Buy me a coffee If you find any of the articles or demos helpful, please consider supporting my work here, you'll have my big thanks!

Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2025 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure