Home featured Left/Right

Community Forums Forums Design Tips and Tricks Home featured Left/Right

This topic is: not resolved

This topic contains 6 replies, has 2 voices, and was last updated by  braddalton 1 year, 7 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #32795

    brook1979
    Participant
    Post count: 41

    Hi People,

    I want to add another home featured left and right BUT only display it on a category page, can anyone point me in the right direction??

    I know how to add the widget area and css for the new ones, BUT I’m stuck here! I know it’s by using a conditional but Im not sure how to write this.

    Thanks in advance if anyone can help.

    #32808

    braddalton
    Participant
    Post count: 10348

    Just published a post on this on my blog.

    Please let me know if you need any help with it.


    #32819

    brook1979
    Participant
    Post count: 41

    Hi Brad,

    Thanks for taking the time to help, much appreciated. Here’s what I have done up to now. I was going to try and explain what ive done, BUT ive messed with it that much Im getting confused….SO heres what ive done in the code.

    Registered the new featured areas:

    genesis_register_sidebar( array(
    ‘id’                => ‘case-featured-left’,
    ‘name’            => __( ‘Case Featured Left’, ‘balance’ ),
    ‘description’    => __( ‘This is the featured left area for case studies.’, ‘balance’ ),
    ) );

    genesis_register_sidebar( array(
    ‘id’                => ‘case-featured-right’,
    ‘name’            => __( ‘Case Featured Right’, ‘balance’ ),
    ‘description’    => __( ‘This is the featured right area for case studies.’, ‘balance’ ),
    ) );

    Then on the home page (I know they shouldnt be on the home.php, BUT im not clear on where to add them).

    function balance_home_loop_helper() {

    if ( is_active_sidebar( ‘home-featured-left’ ) || is_active_sidebar( ‘home-featured-right’ ) ) {

    echo ‘<div id=”home-featured”><div class=”wrap clearfix”>’;

    echo ‘<div class=”home-featured-left”>’;
    dynamic_sidebar( ‘home-featured-left’ );
    echo ‘</div><!– end .home-featured-left –>’;

    echo ‘<div class=”home-featured-right”>’;
    dynamic_sidebar( ‘home-featured-right’ );
    echo ‘</div><!– end .home-featured-right –>’;

    echo ‘</div><!– end .wrap –></div><!– end #home-featured –>’;

    echo ‘<div id=”case-featured”><div class=”wrap clearfix”>’;

    echo ‘<div class=”case-featured-left”>’;
    dynamic_sidebar( ‘case-featured-left’ );
    echo ‘</div><!– end .case-featured-left –>’;

    echo ‘<div class=”case-featured-right”>’;
    dynamic_sidebar( ‘case-featured-right’ );
    echo ‘</div><!– end .case-featured-right –>’;

    echo ‘</div><!– end .wrap –></div><!– end #case-featured –>’;

    }

    }

    remove_action( ‘genesis_loop’, ‘genesis_do_loop’ );
    add_action( ‘genesis_loop’, ‘child_grid_loop_helper’ );

     

    Can you point me in the right direction from here?

    Your assistance is much appreciated.

    Carl

    #32821

    brook1979
    Participant
    Post count: 41

    Hi Brad,

    Using your code JUST in my functions.php file and the NEW featured areas are now showing, HOWEVER they are appearing on the home page…heres the code.

    /** Add the sub widget section */
    add_action( ‘genesis_after_header’, ‘wpsites_sub_widget’, 5 );
    function wpsites_sub_widget() {
    if ( is_category (‘case-studies’) || is_active_sidebar( ‘case-featured-left’ ) || is_active_sidebar( ‘case-featured-right’ ) ) {
    echo ‘<div id=”case-featured”><div class=”wrap clearfix”>’;

    echo ‘<div id=”case-featured”><div class=”wrap clearfix”>’;

    echo ‘<div class=”case-featured-left”>’;
    dynamic_sidebar( ‘case-featured-left’ );
    echo ‘</div><!– end .case-featured-left –>’;

    echo ‘<div class=”case-featured-right”>’;
    dynamic_sidebar( ‘case-featured-right’ );
    echo ‘</div><!– end .case-featured-right –>’;

    echo ‘</div><!– end .wrap –></div><!– end #case-featured –>’;

    }
    }

    At least now I have them showing, feel one step closer now so thanks for that, BUT can you add to this to help me get the new featured areas to just display on the specific category page.

    Thanks.

    Carl

    #32822

    braddalton
    Participant
    Post count: 10348

    Did you paste the code in your child themes functions.php file or the home.php file?

    Should in in functions.php

    Otherwise, try changing the conditional tag to the category i.d
    [php]
    if ( is_category (‘case-studies’)
    [/php]

    I’d test this on a local install first using your theme.


    #32830

    brook1979
    Participant
    Post count: 41

    Hi Brad,

    I pasted your code “as above” in the functions.php fil. Id the code above correct??

    I did use the conditional

    [php]
    if ( is_category (‘case-studies’)
    [/php]

    #32834

    braddalton
    Participant
    Post count: 10348

    For the category i.d Not the category slug sorry:
    [php]
    if ( is_category (‘007’)
    [/php]

    Did you remove the code from the home.php file?


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

You must be logged in to reply to this topic.