Community Forums › Forums › Archived Forums › General Discussion › Agency – Home Page – added a new widget, but not in separate box
- This topic has 8 replies, 2 voices, and was last updated 11 years ago by karlhen.
-
AuthorPosts
-
March 29, 2013 at 3:17 pm #31970karlhenMember
I registered a new widget "my main widget" to my agency home page at poimena.com. Luving it.
See code below.
The challenge is that the new widget is merging into the same box with the home left, home middle, and home right widget right below it. How can I get them to appear in seperate boxes .... the "my main widget" in one box .... the home left, home middle, and home right widgets in a separate box as the orginial layout shows?
Please advise. Thank you.
// Register My Main Widget
genesis_register_sidebar( array(
'id' => 'mymain-widget',
'name' => __( 'My Main Widget', 'agency' ),
'description' => __( 'This Is My Main Widget Area.', 'agency' ),
) );
// Hook My Main Widget Home Page Only
add_action( 'genesis_before_content_sidebar_wrap', 'my_main_widget', 9 );
function my_main_widget() {
if ( is_home() && is_active_sidebar( 'mymain-widget' ) ) {
echo '<div class="mymain-widget"><div class="wrap">';
dynamic_sidebar( 'mymain-widget' );
echo '</div></div>';
}
}March 29, 2013 at 3:52 pm #31982Brad DaltonParticipantCannot use Firebug to inspect elements because you have no right click enabled. Please deactivate.
March 31, 2013 at 9:52 am #32264karlhenMemberApologies. site is now available at poimena.com
March 31, 2013 at 10:37 am #32274Brad DaltonParticipantDid you add any CSS code using this class .mymain-widget when you added the new widget?
This theme already provides a home-welcome and home-slide widget area's so it may be a conflict.
What happens if you change the hook in the code from:
genesis_before_content_sidebar_wrap
to
genesis_before_content
April 1, 2013 at 10:00 am #32447karlhenMemberThanks for the follow-up.
The following is the code for the css
/* Ad mymain Sidebar
------------------------------------------------------------ */
.mymain-widget {
clear: both;
margin: 0 auto;
width: 100%;
}The following is the code added to
genesis_before_content
Hook (with Execute PHP on this hook? checked)<div class="mymain-widget">
<?php dynamic_sidebar( 'mymain-widget ' ); ?>
</div>
April 1, 2013 at 10:17 am #32451karlhenMemberShould I add code to my home page?
Thanks.
April 1, 2013 at 11:00 am #32467Brad DaltonParticipantNo. Maybe the code you pasted is wrong. Please check it against the original tutorial.
April 2, 2013 at 8:30 am #32634karlhenMemberThanks for the follow-up.
The following is the code for the css
/* Ad mymain Sidebar
———————————————————— */
.mymain-widget {
clear: both;
margin: 0 auto;
width: 100%;
}The following is the code added to
genesis_before_content
Hook (with Execute PHP on this hook? checked)<div class=”mymain-widget”>
<?php dynamic_sidebar( ‘mymain-widget ‘ ); ?>
</div>April 5, 2013 at 7:24 pm #33398karlhenMemberokay ... so the widget has been added to my home page. just where I need it. however, the new widget isn't in its own box.
my css (see below). the challenge the widget title on the home page is picking up the link of home-right.
please assist. thanks.
/* Ad main-page-widget Sidebar
------------------------------------------------------------ */
.main-page-widget {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-moz-box-shadow: 0 1px 2px #999;
-webkit-box-shadow: 0 1px 2px #999;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 1px 2px #999;
margin: 20px auto 0;
overflow: hidden;
width: 100%;
} -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.