Genensis 1.9 Upgrade Problems

Community Forums Forums General Discussion Genensis 1.9 Upgrade Problems

This topic is: resolved

This topic contains 13 replies, has 7 voices, and was last updated by  wpsmith 1 year, 3 months ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #10221

    incomeclub
    Participant
    Post count: 7

    I wanted to display only my news category on my main page and had the following code set on my home.php file.  This has always worked until today:

    genesis_grid_loop( array(
    'features' => 1,
    'feature_image_size' => 0,
    'feature_image_class' => 'alignleft post-image',
    'feature_content_limit' => 0,
    'grid_image_size' => 'grid-thumbnail',
    'grid_image_class' => 'alignnone',
    'grid_content_limit' => 250,
    'more' => __( '[Continue reading]', 'genesis' ),
    'cat' => 25,
    ) );

    This no longer works in Genensis 1.9.  My home page now shows all categories.

    Is there a way to specify a specific category to be displayed on Genensis 1.9?

     

    #10251

    jstuartj
    Participant
    Post count: 15

    I appear to be  have a similar issue, only it’s a page with a custom page template – where I have the grid  loop pulling posts from a category using “category_name”. It worked in 1.8, but now  I get just the standard loop.  the if (( genesis_grid_loop is))  as resolving as true, and my echo executes.

    I am also seeing problem with the_content(), I’m calling it at the top of the page template. I had to use   $myHome = get_page($post_id);    and $myHome->post_content; instead.

    Here is what I’m using for my  grid loop, which no longer works under 1.0
    remove_action( ‘genesis_loop’, ‘genesis_do_loop’);
    add_action( ‘genesis_loop’, ‘child_grid_loop_helper’);
    if ( function_exists( ‘genesis_grid_loop’ ) ) {
    echo ‘<h2′>Test Content</h2>’;
    genesis_grid_loop( array(
    ‘features’ => 1,
    ‘feature_image_size’ => 0,
    ‘feature_image_class’ => ‘aligncenter post-image’,
    ‘feature_content_limit’ => 0,
    ‘grid_image_size’ => ‘grid’,
    ‘grid_image_class’ => ‘alignleft post-image’,
    ‘grid_content_limit’ => 100,
    ‘more’ => __( ‘Continue reading…’, ‘genesis’ ),
    ‘posts_per_page’ => 3,
    ‘category_name’ => ‘parent-category-iii’,
    ) );
    } else {
    genesis_standard_loop();
    }

    #10275

    wpsmith
    Moderator
    Post count: 178

    Ok, this needs to be customized properly now in Genesis 1.9 instead of using the Grid Loop. The updated Grid Loop now takes the original WP Query and does not add to it fixing a couple bugs from Genesis 1.8.

    To fix this, you need to follow the instructions here: http://www.billerickson.net/customize-the-wordpress-query/

    So, something like this:


    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( 'cat', '25' );
    }
    }

    OR,

    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_page( $post_id ) ) {
    $query->set( 'category_name', 'parent-category-iii' );
    }

    }


    Travis Smith | Recommended StudioPress Developer & Contributor
    WP Smith | @wp_smith | GitHub

    Due to the forums, please paste code using Pastebin, JS Fiddle (for JavaScript) or GitHub.
    How to use Firebug for Designers by SixRevisions

    #10515

    michaelbuster
    Participant
    Post count: 10

    Sorry I do not understand that code. Before 1.9 I’ve always done this:

    if ( function_exists( ‘genesis_grid_loop’ ) ) {
    genesis_grid_loop( array(
    ‘features’ => 0,
    ‘feature_image_size’ => 0,
    ‘feature_image_class’ => ‘alignright post-image’,
    ‘feature_content_limit’ => 0,
    ‘grid_image_size’        => ‘thumbnail’,
    ‘grid_image_class’        => ‘alignleft’,
    ‘grid_content_limit’ => 250,
    ‘more’ => __( ‘[Read more...]‘, ‘genesis’ ),
    ‘posts_per_page’ => 58,
    /** Do not categories in main loop */
    ‘category__not_in’ => array(2258, 2806, 2695, 2654, 2767)
    ) );
    } else {
    genesis_standard_loop();
    }
    }

    How would I change that code now that the Genesis Grid Loop does not work anymore?

    I don’t want to show categories 2258, 2806, 2695, 2654, 2767 in the main loop.

    BTW the ‘posts_per_page’ => xx does not work anymore either. This is another big issue for me since before I could have a certain number of posts in ‘loop view’, and a different number of posts in blog/archive view (as per Settings>Reading). Now everything is controlled by Settings>Reading.

    Because of these two reasons alone I have dozens of sites screwed up, please help asap thanks.

    #10538

    wpsmith
    Moderator
    Post count: 178

    I just pasted what you would use instead. In Genesis 1.8, the Grid Loop has some issues which were fixed in Genesis 1.9. However, in fixing it, people doing the Grid Loop the wrong way, as done in the code you entered, doesn’t work any more.

    Please take a moment or 30 to read Bill’s post. Since I do not know what sort of setups you have running for the Grid Loop I cannot comment on it.

    See also, my post here.


    Travis Smith | Recommended StudioPress Developer & Contributor
    WP Smith | @wp_smith | GitHub

    Due to the forums, please paste code using Pastebin, JS Fiddle (for JavaScript) or GitHub.
    How to use Firebug for Designers by SixRevisions

    #10571

    michaelbuster
    Participant
    Post count: 10

    Sorry I don’t understand what is this:

    $query->set( ‘cat’, ‘-1,-2′ );

    I’ve always used this:

    ‘category__not_in’ => array(2258, 2806, 2695, 2654, 2767)

    this wouldn’t show (before the 1.9 update) categories 2258, 2806, 2695, 2654, 2767 from the main loop. I get the categories IDs hovering onto them.

    What is ‘-1, -2′ ?

    If I use $query->set( ‘cat’, ‘-2258, -2806, -2695, -2654, -2767′ );

    it doesn’t work.

     

    #10611

    Kraft
    Participant
    Post count: 86

    Are you putting the new code ($query->set(cat…)) in functions.php? WP needs the info early in the process, so placing it in home.php is too late for it to make the change.

    Borrowing from Bill’s site, putting this at the end of functions.php should take care of you:

    add_action( ‘pre_get_posts’, ‘be_exclude_category_from_blog’ );
    /**
    * Exclude Category from Blog
    *
    * @author Bill Erickson
    * @link http://www.billerickson.net/customize-the-wordpress-query/
    * @param object $query data
    *
    */
    function be_exclude_category_from_blog( $query ) {
      global $wp_the_query;
    if( $wp_the_query === $query && $query->is_home() ) {
    $query->set( ‘cat’, ‘-4′ );
    $query->set( ‘posts_per_page’, ’18′ );
    }

    }
     


    Brandon Kraft
    Volunteer
    Blog | Twitter | Business
    Genesis eNews Extended Support

    #10612

    Kraft
    Participant
    Post count: 86

    Are you placing the new code within a functions in your functions.php file? If you’re adding it to home.php, it’s too late in the building process for WordPress to use it.


    Brandon Kraft
    Volunteer
    Blog | Twitter | Business
    Genesis eNews Extended Support

    #10638

    michaelbuster
    Participant
    Post count: 10

    Sure I tried in the fuctions.php file, problem is I do not understand the code.

    Imagine I don’t want to show categories 2258, 2806, 2695, 2654, 2767 in the main loop.

    Before 1.9 I used this in genesis_grid_loop:  ‘category__not_in’ => array(2258, 2806, 2695, 2654, 2767)

    Now with 1.9 what the syntax would be? To exclude an array of categories from the main loop?

    A syntax like this (along with the rest of the code above, in functions.php)

    $query->set( ‘cat’, ‘-2258, -2806, -2695, -2654, -2767′ );

    does not work.

    I opened a ticket yesterday but no reply, I have multiple sites broken, would be grateful is someone could help.

    #10652

    Kraft
    Participant
    Post count: 86

    This is what I added to my functions.php to do what you want (may be off on number of posts, just recalled it was in the 50s):

    http://pastebin.com/UrX7wP6E

    This is modifying the main query by setting what categories to include/exclude. The minus sign preceding instructions WP to exclude. This isn’t a Genesis-specific setup—it’s part of WordPress core:

    http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters , using the set method listed under http://codex.wordpress.org/Class_Reference/WP_Query#Methods

    I made a sandbox site mimicking, as best as I could, your category setup and it worked for me. There may be some other plugin or functions script that is impacting it.

    It needs to be in functions.php (whereas the genesis grid loop is typically found in home.php) and it is separate from the grid loop. Also, when pasting it in, be sure to use straight single-quotes (e.g. rather than the “fancy ones” that is rendered in your previous comment– just copying/pasting from the forum may be an issue).


    Brandon Kraft
    Volunteer
    Blog | Twitter | Business
    Genesis eNews Extended Support

    #10658

    michaelbuster
    Participant
    Post count: 10

    It appears to be working perfectly and solved both problems (exclude some categories and number of posts to show). Thanks a million for taking time to solve this!

    #10674

    GabeVelez
    Participant
    Post count: 2

    Upon immediately updating my client, djyoshi.com, to Genesis 1.9.1  the child theme style.css file wasn’t being read!

    In the html source it read “style.css?ver1.9.1″ which doesn’t exist.

    I already rolled Genesis back to 1.8.2 to maintain the look of the site, but how do I correct this so I can properly update Genesis?

    #10725

    cspowers
    Participant
    Post count: 8

    thanks wpsmith. Your code samples worked for me.

    #10733

    wpsmith
    Moderator
    Post count: 178

    Brandon, thanks!

    Gabe, in the source did it read “style.css?ver1.9.1″ or “style.css?ver=1.9.1″? Also, Gabe could you please start a new thread.


    Travis Smith | Recommended StudioPress Developer & Contributor
    WP Smith | @wp_smith | GitHub

    Due to the forums, please paste code using Pastebin, JS Fiddle (for JavaScript) or GitHub.
    How to use Firebug for Designers by SixRevisions

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

The topic ‘Genensis 1.9 Upgrade Problems’ is closed to new replies.