Community Forums › Forums › Archived Forums › Design Tips and Tricks › Home featured Left/Right
Tagged: balance theme, featured, Home Featured
- This topic has 6 replies, 2 voices, and was last updated 11 years, 5 months ago by Brad Dalton.
-
AuthorPosts
-
April 3, 2013 at 5:31 am #32795brook1979Member
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.
April 3, 2013 at 7:47 am #32808Brad DaltonParticipantJust published a post on this on my blog.
Please let me know if you need any help with it.
April 3, 2013 at 8:10 am #32819brook1979MemberHi 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
April 3, 2013 at 8:27 am #32821brook1979MemberHi 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
April 3, 2013 at 8:32 am #32822Brad DaltonParticipantDid 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
if ( is_category (‘case-studies’)
I'd test this on a local install first using your theme.
April 3, 2013 at 8:57 am #32830brook1979MemberHi Brad,
I pasted your code "as above" in the functions.php fil. Id the code above correct??
I did use the conditional
if ( is_category (‘case-studies’)
April 3, 2013 at 9:08 am #32834Brad DaltonParticipantFor the category i.d Not the category slug sorry:
if ( is_category (‘007’)
Did you remove the code from the home.php file?
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.