Community Forums › Forums › Archived Forums › Design Tips and Tricks › Entry Widget on Front Page only
- This topic has 5 replies, 3 voices, and was last updated 10 years, 2 months ago by
Kabolobari.
-
AuthorPosts
-
April 18, 2014 at 8:29 pm #101239
tpowers
MemberHello,
I've tried a few tags and can't get the widget to show on the first page only... here is my last try and it still shows on the next page of posts. (I've modified this to show right after the header.)//* Hook before post widget after the header content
add_action( 'genesis_after_header', 'expose_after_header', 5 );
function expose_after_header() {if ( is_home() )
genesis_widget_area( 'after-header', array(
'before' => '<div class="after-header widget-area">',
'after' => '</div>',
) );}
Thank you! TheresaApril 19, 2014 at 9:30 am #101283nutsandbolts
MemberTry changing your condition to this:
if (is_home() && !is_paged())
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+September 15, 2015 at 4:30 pm #165635Kabolobari
MemberHi, Nuts and Bolts, could you kindly correct where this code is bugged? I'm trying to hook a widget area after the header on the blog archive page. I've used:
//* Register Blog Page After Header Widget Area
genesis_register_sidebar( array(
'id' => 'bp-after-header',
'name' => __( 'Blog Page After Header', 'wintersong' ),
'description' => __( 'Place stuff here to show before post on blog page', 'wintersong' ),
) );//* Hook Blog Page After Header Widget Area
add_action( 'genesis_after_header', 'add_bp_after_header' );
function add_bp_after_header() {
if ( is_blog() )
genesis_widget_area( 'bp-after-header', array(
'before' => '<div class="bp-after-header widget-area">',
'after' => '</div>',
) );
}And I see the widget area on the backend quite alright but then there's error on the front end. Meaning it's not hooking and I'm bugged. Could you correct the code? I'm pretty awful with php. Thanks.
KB
September 15, 2015 at 4:38 pm #165636nutsandbolts
MemberWhat error are you seeing on the front end? I'm guessing your conditional might be the problem - try replacing
is_blog()withis_home()sinceis_home()is used for whatever page is designated as the main post archive.
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+September 16, 2015 at 1:59 am #165700Kabolobari
MemberThank you, Nuts and Bolts. But if
( is_home( '' ) )? I wonder if that isn't counterintuitive since it's the blog archive page I'm talking about here. How aboutif ( is_page( '79' ) )? I'll try the latter and see. But aside from this line are other lines okay? Thanks.
KB
September 16, 2015 at 2:52 am #165717Kabolobari
MemberThanks very much, Nuts and Bolts
if ( is_home( '79' ) )worked. Take a look at Kabolobari's Blog but I'm having a bit of formatting (CSS) issues, trying to align everything center, even as I have on this category page.Thanks very much!
KB
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.