Community Forums › Forums › Archived Forums › Design Tips and Tricks › Add header left widget Minimum 2.0
- This topic has 16 replies, 3 voices, and was last updated 11 years, 4 months ago by
Brad Dalton.
-
AuthorPosts
-
June 6, 2013 at 10:10 am #44340
genevishgraphics
MemberI would like to add a header left widget area to the Minimum 2.0 theme. I added
`genesis_register_sidebar( array(
'id' => 'header-left',
'name' => __( 'Header Left', 'minimum' ),
'description' => __( 'Header left widget area', 'minimum' ),
) );add_action( 'genesis_header', 'minimum_left_header_widget', 11 );
function minimums_left_header_widget() {
if (is_active_sidebar( 'header-left' ) ) {
echo '';
dynamic_sidebar( 'header-left' );
echo '';
}}
`
to my functions file and the left widget does appear in the back end, but when I add anything there, it does not displat on the front end. I did add a smaller version of the logo to the header to accomodate for the new widget area, but it still does not appear. I am sure I am missing something, I just dont know what it is!!--Update I saw a typo and changed
`'minimum_left_header_widget', 11`
to
`'minimum_header_left_widget', 11 `
I see the widget area appear in visual hook guide, but the content is not showing up - I think it has to do with my header covering it up??? How can I specify a new header image that is not FULL WIDTH>?June 6, 2013 at 11:51 am #44371Brad Dalton
ParticipantYour function name doesn't match.
Try this
You'll also need to add some CSS and make some changes to your title area.
Code not displaying? Grab it from Github.
June 6, 2013 at 11:54 am #44372genevishgraphics
MemberYippeee thanks Brad!!!
June 10, 2013 at 6:41 am #44995genevishgraphics
MemberOne question - how would I remove this widget ONLY from the custom blog template I have created?
June 10, 2013 at 6:45 am #44996Brad Dalton
ParticipantYou would add a conditional tag to exclude the widget from displaying or install the Widget Logic plugin and do the same thing.
June 10, 2013 at 6:56 am #45001genevishgraphics
Memberthat is what I am struggling with - What is the right conditional tag? to only exclude the blog pages? Thanks for your help brad. I'm learning!
June 10, 2013 at 7:07 am #45005genevishgraphics
MemberNM - got it - Just added the plugin and entered in !is_page('blog') and now the left header is on all my pages but the blog pages 🙂
June 10, 2013 at 7:19 am #45008Brad Dalton
ParticipantYou learn fast!
Alternatively, you could add the conditional tag to the code above:
if (!is_page('blog') && is_active_sidebar( 'header-left' ) ) {
June 10, 2013 at 8:29 am #45029genevishgraphics
MemberOf course! Why didnt I think of that?? 🙂 Thanks Brad!
June 10, 2013 at 9:01 am #45032genevishgraphics
MemberI have another question, and I am looking at your website for the answer but cant find it. I am adding a custom body class to my blog page, so I have have an alternate header image for the blog page- BUT I need that alternate image to be on all the blog posts and category pages as well. This would be a conditional tag issue again, I am using this
`
// Add custom body class to the head
add_filter( 'body_class', 'minimum_add_body_class' );
function minimum_add_body_class( $classes ) {
$classes[] = 'page_blog';
if(is_archive() ) {
return $classes;
}
}
`
and now the correct header is there on the blog page, but it is duplicated with the other site header, and the post and category pages only have the old header instead of the "blog" headerJune 10, 2013 at 9:29 am #45041Brad Dalton
ParticipantJune 10, 2013 at 1:37 pm #45108genevishgraphics
MemberYes but if I want to customize the background color etc as well I have to use custom body class right?
Why won't adding
`
if ( is_archive()) work?`June 11, 2013 at 1:53 am #45182Brad Dalton
ParticipantThat's another question.
The one i answered relates to different header images on different pages.
Personally i think you get more control over header images by using PHP rather than CSS or the custom header uploader to display them in your theme.
You can add a custom body class if you want to or use the existing body class which you can grab from the source code.
September 23, 2013 at 9:53 pm #63924zmel
MemberHeader left widget! Brad, thanks so much for the code! I was looking for this for days.
September 23, 2013 at 10:00 pm #63928Brad Dalton
ParticipantYou could also change the float right to float left in the CSS code for the existing header right widget.
September 23, 2013 at 10:22 pm #63930zmel
MemberI was about to try that, but I needed two header widgets, so this will do the trick. Now I just need to add some CSS and move my title area. Thanks; I liked your FB page!
September 24, 2013 at 8:32 am #63960Brad Dalton
ParticipantThanks for the like.
I will write about this as its interesting and i would like to work out another solution that's easier.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.