![]() |
|
||||||
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Hi,
Does anyone know the call for sidebars made with genesis simple sidebars? I'm trying to hook it one onto a custom post type. Thanks! |
|
#2
|
|||
|
|||
|
In the function that registers your CPT, you'd normally have an array of arguments, one of which is 'supports'. The 'support' argument itself can be an array, and to the argument you add 'genesis-simple-sidebars'.
Below is a working example: PHP Code:
|
|
#3
|
|||
|
|||
|
Wooh! thanks Bill. Definitely works for what I want to accomplish.
A quick question if you don't mind. Ideally, I'd like to write a function replacing the primary sidebar for this post type with one created with simple sidebars. I've done this before with registered sidebars via functions.php, but not sure about how it would be done with simple sidebars. In the meantime, the solution you provided will work and allows for a lot of flexibility. But I can see where this can be a little tedious if I'd like to assign one sidebar to the entire post type instead of assigning it on every single post. Just trying to cover all bases. Heres how I've done it before Code:
remove_action ('genesis_sidebar', 'genesis_do_sidebar');
add_action ('genesis_sidebar', 'about_nav');
function about_nav() {
if (!dynamic_sidebar('sidebarname'));
}
PHP Code:
|
|
#4
|
|||
|
|||
|
On your first question, it seems like it might work. The code in your functions.php will execute after Simple Sidebars executes, so the sidebars should exist for you to assign a sidebar to a CPT. Give it a try and see how it works out.
On your second question, Simple Sidebars stores the sidebars it creates as records in the options table. It grabs the sidebars created from these options. If you want a sidebar to appear in the pull down list, you'd be better off to fire the code that Simple Sidebars uses to create a sidebar. You could do something conditionally, like check if a Simple Sidebars function exists or the plugin is activated, and if so, call its functions to create the sidebar. Then, they'd exist in the Simple Sidebar options and would appear in the pull down. You also might get better visibility to post questions like these in the Plugins forum here. |
| Thread Tools | |
| Display Modes | |
|
|
© Copyright 2012 Copyblogger Media LLC · StudioPress™ is a trademark of Copyblogger Media LLC
Privacy Policy | Refund Policy | Terms of Service | Affiliate Program | Contact Us