Community Forums › Forums › Archived Forums › Design Tips and Tricks › Output Alt Sidebar below Sidebar
- This topic has 7 replies, 2 voices, and was last updated 10 years, 1 month ago by collegeofwooster.
-
AuthorPosts
-
March 18, 2014 at 10:41 pm #95600collegeofwoosterParticipant
Is there a hook that will allow one to output the Alt Sidebar under the Sidebar but not inside the .sidebar class? I tried using genesis_after_sidebar_widget_area but that still puts the Alt Sidebar inside the .sidebar class. I was trying to avoid having to add my own unless absolutely necessary. Thanks.
March 18, 2014 at 10:44 pm #95602Genesis DeveloperMemberYou need to modify the CSS. What is your site URL?
March 19, 2014 at 6:19 am #95646collegeofwoosterParticipantgenwrock,
Thanks.
It is in a local development environment.
I don't think CSS tricks are going to solve it since I want an HTML structure of
<div class="content-sidebar-wrap"> <aside class="sidebar sidebar-primary widget-area" role="complementary" itemscope="itemscope" itemtype="http://schema.org/WPSideBar"> <section class="widget widget_text"> <div class="widget-wrap"> <h4 class="widgettitle">Primary Sidebar Widget Area</h4> <div class="text widget"> <p>This is the Primary Sidebar Widget Area. You can add content to this area by visiting your <a href="http://wpbeta.dev/onsitephysicalrehab/wp-admin/widgets.php">Widgets Panel</a> and adding new widgets to this area. </p> </div> </div> </section> </aside> <aside class="sidebar sidebar-secondary widget-area" role="complementary" itemscope="itemscope" itemtype="http://schema.org/WPSideBar"> <section class="widget widget_text"> <div class="widget-wrap"> <h4 class="widgettitle">Secondary Sidebar Widget Area</h4> <div class="text widget"> <p>This is the Secondary Sidebar Widget Area. You can add content to this area by visiting your <a href="http://wpbeta.dev/onsitephysicalrehab/wp-admin/widgets.php">Widgets Panel</a> and adding new widgets to this area. </p> </div> </div> </section> </aside> <aside class="content" role="main" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/Blog"> </aside> </div>
and CSS tricks aren't going to modify the HTML structure. Trying to move the Alt Sidebar using the genesis_after_sidebar_widget_area hook results in an HTML structure of
<div class="content-sidebar-wrap"> <aside class="sidebar sidebar-primary widget-area" role="complementary" itemscope="itemscope" itemtype="http://schema.org/WPSideBar"> <section class="widget widget_text"> <div class="widget-wrap"> <h4 class="widgettitle">Primary Sidebar Widget Area</h4> <div class="text widget"> <p>This is the Primary Sidebar Widget Area. You can add content to this area by visiting your <a href="http://wpbeta.dev/onsitephysicalrehab/wp-admin/widgets.php">Widgets Panel</a> and adding new widgets to this area. </p> </div> </div> </section> <section class="widget widget_text"> <div class="widget-wrap"> <h4 class="widgettitle">Secondary Sidebar Widget Area</h4> <div class="text widget"> <p>This is the Secondary Sidebar Widget Area. You can add content to this area by visiting your <a href="http://wpbeta.dev/onsitephysicalrehab/wp-admin/widgets.php">Widgets Panel</a> and adding new widgets to this area. </p> </div> </div> </section> </aside> <aside class="content" role="main" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/Blog"> </aside> </div>
So I don't think there is a hook that will do what I want. Which is OK but just kind of a pain.
March 19, 2014 at 6:48 am #95652Genesis DeveloperMemberCall the hook. My end it is working
add_action( 'genesis_sidebar', 'genesis_do_sidebar_alt' );
You can also use the condition like this way
if( $layout == 'sidebar-content') add_action( 'genesis_sidebar', 'genesis_do_sidebar_alt' );
March 19, 2014 at 7:55 am #95666collegeofwoosterParticipantgenwrock,
If you look at the HTML output of either of your hook uses you'll see that it is not outputting things the way I want. In either case you will see a single
<aside>
with classes sidebar, sidebar-primary, and widget-area. What I want is two asides one with classes sidebar, sidebar-primary, and widget-area and the other with sidebar, sidebar-secondary, and widget-area where the asides are consecutive in the HTML.The trick is to use
add_action( 'genesis_after_content', 'genesis_get_sidebar_alt' );
.March 19, 2014 at 8:15 am #95673Genesis DeveloperMemberOk. So your problem is solved now right?
March 19, 2014 at 8:36 am #95679Genesis DeveloperMemberOK. I am giving two kinds of code here as per your requirement
remove_action( 'genesis_after_content', 'genesis_get_sidebar' ); add_action( 'genesis_before_content', 'genesis_get_sidebar' ); add_action( 'genesis_before_content', 'genesis_get_sidebar_alt' );
OR
remove_action( 'genesis_after_content', 'genesis_get_sidebar' ); add_action( 'genesis_before_content', 'genesis_get_sidebar' ); add_action( 'genesis_before_content', 'genesis_get_custom_sidebar_alt' ); function genesis_get_custom_sidebar_alt(){ //* Output secondary sidebar structure genesis_markup( array( 'html5' => '<aside %s>', 'xhtml' => '<div id="sidebar-alt" class="sidebar widget-area">', 'context' => 'sidebar-secondary', ) ); do_action( 'genesis_before_sidebar_alt_widget_area' ); do_action( 'genesis_sidebar_alt' ); do_action( 'genesis_after_sidebar_alt_widget_area' ); genesis_markup( array( 'html5' => '</aside>', //* end .sidebar-secondary 'xhtml' => '</div>', //* end #sidebar-alt ) ); }
I think that your HTML markup will be solved now
March 19, 2014 at 9:09 am #95684collegeofwoosterParticipantSorry, it was resolved before but I hadn't gotten a chance to get back. Thanks.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.