Community Forums › Forums › Archived Forums › General Discussion › Custom sidebar per page?
Tagged: blog, custom sidebar, posts
- This topic has 8 replies, 3 voices, and was last updated 9 years, 11 months ago by jmamuzich.
-
AuthorPosts
-
May 17, 2014 at 5:55 pm #105668bionaryMember
Ok, so I want to scream after spending the last 2 days trying out so many plugins that promise customization for sidebars.
I would like to have different sidebars for some page.For instance: most all pages should have "latest posts" and "categories" widgets but I would like my blog page, any posts, or any date page (http://mysite.com/2014) to have the "calendar", "search", and "tags" widget.
So far I have tried plugins:
custom sidebars 1.5
Genesis Simple Sidebars 2.0.1
Per Page Sidebars 2.0
Widget Logic 0.57To my chagrin, non of these work with my genesis/beautiful theme. They either don't work at all or throw all kinds of errors when using them, which makes them unstable and not an option for production code I'm afraid. (Honestly this was my wp experience 6 years ago and the reason I stayed away... I spent more time hacking away at stuff trying to get it to work)
Does anyone have advice for customizing sidebar widgets for specific pages. I'm open to: a) plugins that actually work, b)some kind of php function/template solution.
Thanks.
May 17, 2014 at 7:51 pm #105674nutsandboltsMemberCan you talk a little more about what happened with the Genesis Simple Sidebars plugin? I have used that on dozens of sites and at least 3-4 of them are using Beautiful Pro. I use it on my own sites as well.
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+May 17, 2014 at 9:06 pm #105686bionaryMemberSure,
The genesis simple sidebars plugin, worked for some pages and not others and when clicking on update (setting it up) it always threw back a pile of php errors. I inquired about it via the paid members support and I got this response:
"We are aware of the issue and we are working on a fix."
May 17, 2014 at 9:07 pm #105688nutsandboltsMemberHmm, that's very interesting and something I haven't come across - will have to go back to a few client sites and make sure it's still working for them. Thanks for the details!
There are some manual ways to add different sidebars to your site. Here's a great tutorial (it's for custom post types but can work with any conditional): http://www.carriedils.com/sidebar-custom-post-type/
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+May 22, 2014 at 7:45 pm #106430bionaryMemberSo I triedd out that link you mentioned above. It works great but fails under one circumstance (which is of course how I need to use it) let me explain....
first the code:// Register new sidebar genesis_register_sidebar( array( 'id' => 'job-single-sidebar', 'name' => 'Single Job Sidebar', 'description' => 'This is the sidebar for single job pages[ this was added via functions.php ].', ) ); add_action('get_header','cd_change_genesis_sidebar'); function cd_change_genesis_sidebar() { if ( is_page('blog') ) { remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); //remove the default genesis sidebar add_action( 'genesis_sidebar', 'cd_do_sidebar' ); //add an action hook to call the function for my custom sidebar } } //Function to output my custom sidebar function cd_do_sidebar() { dynamic_sidebar( 'job-single-sidebar' ); }
It removes replaces the default sidebar except on the page that is designated as the blog if choosen in settings.
So I had Settings>Reading>front page displays set to Post Page:blog .... and it won't do the sidebar swap on that page. ... I did several tests with other pages/configurations and for some reason the swap will not happen on the designated "front page display"May 22, 2014 at 9:51 pm #106437nutsandboltsMemberInstead of using
if ( is_page('blog') ) {
try using
if ( is_home() ) {
I know that seems odd if the blog page isn't the homepage, but "home" in this case refers to the page that displays the list of most recent posts.
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+October 20, 2014 at 10:39 am #128447jmamuzichMemberHi Nuts and Bolts,
I was wondering what the snippet of code for this would be to register it on the blog and single posts?
Thanks in advance,
Jaclyn
October 20, 2014 at 10:42 am #128448nutsandboltsMemberHi Jaclyn,
Try using
if ( is_home() || is_single() ) {
- that should display on the blog archives and on single posts.
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+October 20, 2014 at 10:45 am #128449jmamuzichMemberWorked perfectly. Thank you SO MUCH! I couldn't remember how to write it out for more than one 😉
You're a lifesaver!
- Jaclyn
-
AuthorPosts
- The topic ‘Custom sidebar per page?’ is closed to new replies.