Adding Simple sidebar to template
Does anyone know the call for sidebars made with genesis simple sidebars? I'm trying to hook it one onto a custom post type.
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:
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
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.
|All times are GMT -5. The time now is 10:34 PM.|
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.