Recent Genesis Update broke theme? 1.91

Community Forums Forums Design Tips and Tricks Recent Genesis Update broke theme? 1.91

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  hivehealthmedia 1 year, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #10841

    hivehealthmedia
    Participant
    Post count: 1

    Hey everyone,

    I recently updated one of my sites to Genesis 1.91

    Unfortunately, it broke my home page design.

    Prior to the update, I used Genesis Featured widgets amplified to populate posts on my homepage.

    Here’s the before:  http://www.hivehealthmedia.com/

    Now, I get the 10 posts that show up on category and tag pages that were previously removed from the homepage, so only the Genesis Featured Widgets posts would show up.

    After:  http://www.jarretmorrow.com/

    How do I block the 2 column posts from appearing on the homepage?

    This is what the theme had previously (assuming this is the code that did it) that doesn’t work any more:

     

    // Force layout on home
    add_filter(‘genesis_pre_get_option_site_layout’, ‘be_home_layout’);
    function be_home_layout($opt) {
    if ( is_home() || is_front_page() )
    $opt = ‘content-sidebar’;
    return $opt;
    }

     

     

     

    #12994

    Dorian Speed
    Participant
    Post count: 140

    Do you know if your homepage uses the grid loop?


    Bringing websites Up to Speed
    Firebug will light the way to understanding the secrets of the Internet!

    #22403

    hivehealthmedia
    Participant
    Post count: 1

    Yes, I believe so.

     

    Here’s my home.php file:

    <code>

    <?php
    // Custom Home Page

    add_action( ‘genesis_before_loop’, ‘child_maybe_do_grid_loop’ );
    /**
    * Before we get to the loop, see if we’re anywhere but a single page. If so,
    * swap out the standard loop for our grid loop.
    *
    * @author Gary Jones
    * @link http://dev.studiopress.com/genesis-grid-loop-advanced.htm
    */
    function child_maybe_do_grid_loop() {

    // Amend this conditional to pick where this grid looping occurs
    if ( ! is_single() && ! is_page() ) {

    // Remove the standard loop
    remove_action( ‘genesis_loop’, ‘genesis_do_loop’ );

    // Use the prepared grid loop
    add_action( ‘genesis_loop’, ‘child_do_grid_loop’ );

    // Add some extra post classes to the grid loop so we can style the columns
    add_filter( ‘genesis_grid_loop_post_class’, ‘child_grid_loop_post_class’ );
    }
    }

    /**
    * Prepare the grid loop.
    *
    * Takes care of existing query arguments for the page e.g. if it’s a category
    * archive page, then the “cat” argument is carried into the grid loop, unless
    * it’s overwritten in the $grid_args.
    *
    * @author Gary Jones
    * @link http://dev.studiopress.com/genesis-grid-loop-advanced.htm
    * @uses genesis_grid_loop() Requires Genesis 1.5
    */
    function child_do_grid_loop() {

    global $query_string, $paged;

    // Ensure the arguments for the normal query for the page are carried forwards
    // If you’re using a Page to query the posts (e.g. with the Blog template), comment out the next line.
    wp_parse_str( $query_string, $query_args );

    // Create an array of arguments for the loop – can be grid-specific, or
    // normal query_posts() arguments to alter the loop
    if (is_home()) {
    $grid_args = array(
    ‘features’ => 1,
    ‘feature_image_size’ => ‘Home Thumbnail’,
    ‘feature_image_class’ => ‘alignleft post-image’,
    ‘feature_content_limit’ => 400,
    ‘grid_image_size’ => ‘grid-thumbnail’,
    ‘grid_image_class’ => ‘alignleft post-image’,
    ‘grid_content_limit’ => 70,
    ‘more’ => __( ‘Continue reading →’, ‘genesis’ ),
    ‘posts_per_page’ => 0,
    );
    }
    if (is_category() || is_author()) {
    $grid_args = array(
    ‘features’ => 1,
    ‘feature_image_size’ => ‘Home Thumbnail’,
    ‘feature_image_class’ => ‘alignleft post-image’,
    ‘feature_content_limit’ => 400,
    ‘grid_image_size’ => ‘grid-thumbnail’,
    ‘grid_image_class’ => ‘alignleft post-image’,
    ‘grid_content_limit’ => 70,
    ‘more’ => __( ‘Continue reading →’, ‘genesis’ ),
    ‘posts_per_page’ => 9,
    );
    }

    // Make sure the first page has a balanced grid
    if ( 0 == $paged )
    // If first page, add number of features to grid posts, so balance is maintained
    $grid_args['posts_per_page'] += $grid_args['features'];
    else
    // Keep the offset maintained from our page 1 adjustment
    $grid_args['offset'] = ( $paged – 1 ) * $grid_args['posts_per_page'] + $grid_args['features'];

    // Merge the standard query for this page, and our preferred loop arguments
    genesis_grid_loop( array_merge( (array) $query_args, $grid_args ) );

    }

    /**
    * Add some extra body classes to grid posts.
    *
    * Change the $columns value to alter how many columns wide the grid uses.
    *
    * @author Gary Jones
    * @link http://dev.studiopress.com/genesis-grid-loop-advanced.htm
    *
    * @global array $_genesis_loop_args
    * @global integer $loop_counter
    * @param array $classes
    */
    function child_grid_loop_post_class( $grid_classes ) {
    global $_genesis_loop_args, $loop_counter;

    // Alter this number to change the number of columns – used to add class names
    $columns = 3;

    // Only want extra classes on grid posts, not feature posts
    if ( $loop_counter >= $_genesis_loop_args['features'] ) {

    // Add genesis-grid-column-? class to know how many columns across we are
    $grid_classes[] = sprintf( ‘genesis-grid-column-%s’, ( ( $loop_counter – $_genesis_loop_args['features'] ) % $columns ) + 1 );

    // Add size1of? class to make it correct width
    $grid_classes[] = sprintf( ‘size1of%s’, $columns );
    }
    return $grid_classes;
    }

    /** Move the nave to the end of page */
    remove_action(‘genesis_after_endwhile’, ‘genesis_posts_nav’);
    //add_action(‘genesis_after_content’, ‘genesis_posts_nav’);
    // add actions and filters to only the home page for the teasers.
    // if your blog isn’t on the home page swap out “is_home()” to where your blog may be.
    // for example: is_page_template(‘blog.php’)
    add_action(‘wp’, ‘enable_post_teaser_logic’);
    function enable_post_teaser_logic() {
    if( genesis_get_option(‘teasers_enable’) == 1 ) {
    if (is_home() ) {
    remove_action(‘genesis_post_content’,’genesis_do_post_content’);
    add_action(‘genesis_post_content’,’genesis_do_teaser_content’);
    add_action(‘genesis_before_post’,’post_teaser_do_open’, 10, 2);
    add_action(‘genesis_before_post’,’post_teaser_pertwo_wrap_open’, 15, 2);
    add_action(‘genesis_after_post’,’post_teaser_pertwo_wrap_openclose’);
    add_action(‘genesis_after_endwhile’,’post_teaser_pertwo_wrap_close’, 5, 2);
    add_action(‘genesis_after_endwhile’,’post_teaser_do_close’, 6, 2);
    add_filter(‘genesis_options’, ‘define_content_archive_home_setting’, 10, 2);
    add_filter(‘post_class’, ‘add_oddeven_class’);
    if( genesis_get_option(‘disable_teaser_meta’) == 1 ) {
    remove_action(‘genesis_after_post_content’, ‘genesis_post_meta’);
    add_filter(‘genesis_after_post_content’, ‘genesis_post_meta_teaser_logic’);
    }
    }
    }
    }

    // adds a class of odd-post or even-post
    // to the post class depending on the count of the loop.
    function add_oddeven_class($classes){
    global $post, $loop_counter;

    $oddeven = ($loop_counter&1) ? “odd-post” : “even-post”;
    $classes[] = $oddeven;

    return $classes;
    }

    // This makes sure the_content is shown as default on homepage.
    function define_content_archive_home_setting($options, $setting) {
    if($setting == GENESIS_SETTINGS_FIELD) {
    $options['content_archive'] = ‘full’;
    }
    return $options;
    }

    // Makes the teaser use the excerpt.
    function genesis_do_teaser_content() {
    global $loop_counter;

    if( $loop_counter >= genesis_get_option(‘numof_full_posts’) || is_paged() >= 2 ) {
    the_excerpt();
    if ( genesis_get_option(‘readmore_on_teasers’) == 1 ) {
    echo’<a class=”more-link” href=”‘.get_permalink().’”>[Read more...]</a>’;
    }
    } else {
    the_content(__(‘[Read more...]‘, ‘genesis’));
    }
    }

    // This will remove post meta on teaser posts
    function genesis_post_meta_teaser_logic() {
    global $loop_counter;
    if ( is_page() || $loop_counter >= genesis_get_option(‘numof_full_posts’) || is_paged() >= 2 )
    return; // don’t do post-meta on pages or teasers

    $post_meta = ‘<span class=”categories”>Filed Under: </span> ‘;
    printf( ‘
    <div class=”post-meta”>%s</div>
    ‘, apply_filters(‘genesis_post_meta’, $post_meta) );

    }

    // Wraps the post teaser area with its own div.
    function post_teaser_do_open() {
    global $loop_counter;

    if( !is_paged() && $loop_counter == genesis_get_option(‘numof_full_posts’) || is_paged() >= 2 && $loop_counter == 0) {
    echo ‘
    <div id=”post-teasers”>’;
    }
    }
    //Opens the div for the first pair of teasers. This helps to keep the area of two
    //the same height so can have a flexible height for the teasers.
    function post_teaser_pertwo_wrap_open() {
    global $loop_counter;

    if( !is_paged() && $loop_counter == genesis_get_option(‘numof_full_posts’) || is_paged() >= 2 && $loop_counter == 0) {
    echo ‘
    <div class=”post-teasers-pair”>’;
    }
    }

    // Wraps the a pair of teasers with their own div. This helps to keep the area of two
    //the same height so can have a flexible height for the teasers.
    function post_teaser_pertwo_wrap_openclose() {
    global $loop_counter, $posts;
    if( $loop_counter == get_option(‘posts_per_page’ )-1 || $loop_counter == sizeof($posts)-1 ) return;
    if( !is_paged() && $loop_counter > genesis_get_option(‘numof_full_posts’) && $loop_counter % 2 || is_paged() >= 2 && $loop_counter % 2) {
    echo ‘</div>
    <div class=”post-teasers-pair”>’;
    }
    }

    // Closing div to teaser pairs.
    function post_teaser_pertwo_wrap_close() {
    global $loop_counter;

    if( $loop_counter >= genesis_get_option(‘numof_full_posts’) || is_paged() >= 2 ) {
    echo ‘</div>
    ‘;
    }
    }
    // Closing div to post teaser area.
    function post_teaser_do_close() {
    global $loop_counter;

    if( $loop_counter >= genesis_get_option(‘numof_full_posts’) || is_paged() >= 2 ) {
    echo ‘</div>
    ‘;
    }
    }
    // Remove the post meta function
    remove_action(‘genesis_after_post_content’, ‘genesis_post_meta’);
    ?>

    </code>

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

You must be logged in to reply to this topic.