Community Forums › Forums › General Discussion › Home.php Not Working
This topic contains 5 replies, has 3 voices, and was last updated by Jen Baumann 4 months, 1 week ago.
-
AuthorPosts
-
January 15, 2013 at 2:15 pm #12098
The number of posts set in the home.php is not working. It is showing the number of posts under “Settings > Reading > Blog pages show at most”
Happening on several sites
Started doing this after some updates – not sure if it was wordpress 3.5 or Genesis 1.9
Thanks for any help.
January 15, 2013 at 3:04 pm #12112This is an issue with the Grid Loop.
Place the code below in your functions.php and remove the post_per_page state in your grid loop in your home.php
add_action( ‘pre_get_posts’, ‘wps_limit_loop_to_cat’ );
/**
* Limit Grid Loop to a Specific Category on a Specific Page
*
* @author Bill Erickson
* @author Travis Smith
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
*/
function wps_limit_loop_to_cat( $query ) {
// To Limit it on a page, change $post_id
if( $query->is_main_query() && $query->is_home() ) {$query->set( ‘posts_per_page’, ’7′ );
}
}January 15, 2013 at 3:48 pm #12124See this: http://www.studiopress.com/forums/topic/change-home-page-grid-layout-quattro-theme/#post-12114
Note the code didn’t post well so there’s a note below the code block. Change the 2 to whatever number you need.
Jennifer “Hermione” Baumann | Recommended StudioPress Developer
Dream Whisper Designs | Themessence | @dreamwhisper | If I’ve helped, like me on FacebookJanuary 15, 2013 at 4:58 pm #12147Added this to functions.php file
add_action( ‘pre_get_posts’, ‘child_change_home_query’ );
function child_change_home_query( && $query ) {
if( $query->is_main_query() && $query->is_home() ) {
$query->set( ‘posts_per_page’, ’6′ );
}
}and get this Error message
Parse error: syntax error, unexpected ‘;’ in /home/content/41/9844641/html/wp-content/themes/focus/functions.php on line 25
January 15, 2013 at 5:00 pm #12148Figure out that I need to ad this
add_action( 'pre_get_posts', 'child_change_home_query' );
function child_change_home_query( $query ) {
if( $query->is_main_query() && $query->is_home() ) {
$query->set( 'posts_per_page', '6' );
}
}instead
January 16, 2013 at 6:12 pm #12480Glad you got it sorted.

Jennifer “Hermione” Baumann | Recommended StudioPress Developer
Dream Whisper Designs | Themessence | @dreamwhisper | If I’ve helped, like me on Facebook -
AuthorPosts
The topic ‘Home.php Not Working’ is closed to new replies.