Home.php Not Working

Community Forums Forums General Discussion Home.php Not Working

This topic is: resolved

This topic contains 5 replies, has 3 voices, and was last updated by  Jen Baumann 1 year, 6 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #12098

    Robin
    Participant
    Post count: 42

    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

    http://boulderlocavore.com

    http://healthylivinghowto.com

    Started doing this after some updates – not sure if it was wordpress 3.5 or Genesis 1.9

    Thanks for any help.

    #12112

    varickdesign
    Participant
    Post count: 11

    This 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′ );
    }
    }

    #12124

    Jen Baumann
    Keymaster
    Post count: 325

    See 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.


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

    #12147

    Robin
    Participant
    Post count: 42

    Added 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

    #12148

    Robin
    Participant
    Post count: 42

    Figure 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

    #12480

    Jen Baumann
    Keymaster
    Post count: 325

    Glad you got it sorted. :)


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Home.php Not Working’ is closed to new replies.