Community Forums › Forums › Archived Forums › Design Tips and Tricks › Adding Extra Sidebars
Tagged: add a sidebar
- This topic has 7 replies, 3 voices, and was last updated 10 years ago by ZAAAX.
-
AuthorPosts
-
November 19, 2014 at 2:55 pm #132195ZAAAXMember
Hi there, I'm trying to add an extra Primary sidebar, or at least another sidebar so I can select different sidebars for different pages / post.
I found the primary sidebar making code in Genesis: Sidebar (sidebar.php) as per below
//* Output primary sidebar structure genesis_markup( array( 'html5' => '<aside %s>', 'xhtml' => '<div id="sidebar" class="sidebar widget-area">', 'context' => 'sidebar-primary', ) );
So I figure if I add the same code slightly edited, there should be another sidebar appearing named secondary .... right?
Code would be .....
//* Output secondary sidebar structure genesis_markup( array( 'html5' => '<aside %s>', 'xhtml' => '<div id="sidebar-secondary" class="sidebar widget-area">', 'context' => 'sidebar-secondary', ) );
Can someone please let me know if I'm on the right track?
Crisp!
November 19, 2014 at 3:01 pm #132196nunotmpMemberThe code you created above is not for a sidebar this is a genesis function to output proper HTML for HTML5 sites. You need to use this
genesis_register_sidebar( array( 'id' => 'sidebar-id', 'name' => 'Sidebar Name'), 'description' => 'This is the description.', ) );
Paste this into your functions.php file and edit it to fit your needs.
November 19, 2014 at 3:08 pm #132198Lauren @ OnceCoupledMemberIf you're still having trouble, it might be more helpful for you to post what you're trying to achieve. Then we can let you know if there's a better way to go about this in the first place. 🙂
Best,
Lauren
We create mobile-first, PageSpeed-optimized, pixel-perfect custom themes! https://www.oncecoupled.com
November 19, 2014 at 3:21 pm #132202ZAAAXMemberOk tried that code and replaced some bits to suit ... like this
genesis_register_sidebar( array( 'id' => 'sidebar-secondary', 'name' => 'Sidebar Secondary'), 'description' => 'This is the description.', ) );
And then got a parse error with no site displaying at all.
I placed the code into the functions.php of the theme Executive Pro. So what did I do wrong?
Crisp!
November 19, 2014 at 3:26 pm #132204ZAAAXMemberHi Lauren, thanks.
Just wanting to add an extra sidebar so I can use the simple sidebar plugin to allocate which sidebar to display with different pages.
Crisp!
November 19, 2014 at 3:34 pm #132211nunotmpMemberSorry about that. On the line that says
'name' => 'Sidebar Secondary')
there is a parenthesis. Removed belowgenesis_register_sidebar( array( 'id' => 'sidebar-secondary', 'name' => 'Sidebar Secondary', 'description' => 'This is the description.', ) );
November 19, 2014 at 4:20 pm #132220ZAAAXMemberOk looks like that code worked @nunotmp
Only problem is now tho, when I go to a page from Admin to edit or select the sidebar with simple sidebar plugin there's no other sidebar option to select except the primary one.
I've linked an image for you to check out if you want.
Image Of No Sidebar Options in Simple Sidebar
Crisp!
November 19, 2014 at 5:36 pm #132227ZAAAXMemberLOLOL, ok maybe I'm one of those people who calls Microsoft Support moaning about how the computer doesn't work even tho there's a power outage and I'm told to pack it back into the box cos I'm too dumb to own one, is possible I guess.
I say this cos I just found the Simple Sidebar plugin creator which I didn't see before under the Genesis tab in the Admin Menu.
Sheesh, talk about embarrassment & my face is red!
😉
Crisp!
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.