StudioPress Community Forums
  StudioPress Community Forums > Forums > General Discussion
For help and support, access to your downloads, or to manage your account please log into My StudioPress.

These forums have been set to read-only so you can browse the existing topics for any questions you may have.

For general discussion on WordPress, CSS and design (NOT for support) visit the new Community Forums.
 
 
Thread Tools Display Modes
  #1  
Old 10-17-2012, 02:27 PM
kristinsf kristinsf is offline
Registered User
Pro Plus Member
 
Join Date: Dec 2010
Posts: 24
Default Simple Sidebar per Post Type

Hi, I'm using genesis, wpml and events manager pro. things are seeming pretty complicated.

events manager lists events as posts with the type "event". I want these posts to have a sidebar i created in simple sidebars called "Events Sidebar" #events-sidebar. I tried attaching the custom sidebar to the event category - it is an option in the events categories to set the sidebar, but it didn't work.

I'm hoping there are a few lines of code that I can add to functions.php to say "when an event has post_type of event, use event-sidebar instead of the regular sidebar.

any help with this would be way appreciated.

my php is not strong.
  #2  
Old 10-17-2012, 02:52 PM
Bill Murray Bill Murray is offline
Registered User
Pro Plus Member
 
Join Date: Aug 2010
Posts: 645
Default

You need to make sure the post type is registered with support for simple sidebars. See this thread.

You can try to find where the post type is registered in your plugin and edit the plugin file, but that would make it difficult to upgrade the plugin as new versions are released. You could also ask the plugin developer if the arguments for the post type registration are filterable. That way could modify these arguments without modifying the plugin itself.

Given that you said your PHP skills are not strong, contacting the plugin author with this info might be your best bet. Otherwise, you'll have to maintain a modified version of the plugin.

Hope that helps.
  #3  
Old 10-17-2012, 03:52 PM
kristinsf kristinsf is offline
Registered User
Pro Plus Member
 
Join Date: Dec 2010
Posts: 24
Default

Thanks for your help, Bill. It seems I can't register support for simple sidebars through functions.php? i definitely don't want to hack the plugin if I can possibly avoid it. Let me know your thoughts and I appreciate your help...

The plugin supoport block is

Code:
$event_post_type = array(	
		'public' => true,
		'hierarchical' => false,
		'show_ui' => true,
		'show_in_menu' => true,
		'show_in_nav_menus'=>true,
		'can_export' => true,
		'exclude_from_search' => false,
		'publicly_queryable' => true,
		'rewrite' => array('slug' => EM_POST_TYPE_EVENT_SLUG,'with_front'=>false),
		'has_archive' => get_option('dbem_cp_events_has_archive', false) == true,
		'supports' => apply_filters('em_cp_event_supports', array('custom-fields','title','editor','excerpt','comments','thumbnail','author')),
  #4  
Old 10-17-2012, 10:20 PM
Bill Murray Bill Murray is offline
Registered User
Pro Plus Member
 
Join Date: Aug 2010
Posts: 645
Default

First, I haven't checked this code, so before you edit anything, make sure you have FTP access to your site and a backup of your functions.php. Even a minor typo can break your site, but you can quickly and easily fix that by deleting the broken file (the one you just edited with the typo) and replacing it with the good backup. Post back with the results; if it doesn't work, post any errors and we'll go from there.

It looks like your plugin applies filters, which is good. So you can add the code below to your child theme's functions.php and you should see simple sidebars on your CPT:

PHP Code:
function wpp_events_sidebar() {
    
$wpp_sidebar = array('custom-fields','title','editor','excerpt','comments','thumbnail','author','genesis-simple-sidebars');
    return 
$wpp_sidebar;
}
add_filter'em_cp_event_supports','wpp_events_sidebar' ); 
This should replace the supports array from the CPT registration with a new one that includes support for simple sidebars.

One additional caution: that code is really basic, and doesn't check to see if the plugin is active or if the filter is being applied. Those things could break if you deactivate the plugin for any reason. It should be a starting point and you can go from there. Also, if you opt to modify the plugin, you can simply modify the supports array to match what I included above.

Hope that helps.
  #5  
Old 10-18-2012, 12:46 PM
kristinsf kristinsf is offline
Registered User
Pro Plus Member
 
Join Date: Dec 2010
Posts: 24
Default

Thanks for this - I inserted that code in my functions.php, and then went to the event category and set the sidebar for that category but nothing changes on the page. I have an inquiry in to the plugin developer and i'll let you know if I get it working. Unless you are available for hire to help me to make it work, in which case I would gladly go that route. Private message me, if so!
  #6  
Old 10-18-2012, 02:43 PM
Bill Murray Bill Murray is offline
Registered User
Pro Plus Member
 
Join Date: Aug 2010
Posts: 645
Default

Is this a paid plugin? Is there a free version that can be tested? Can you provide a link to the plugin site?

You say you are changing the sidebar for an event category. Is that different for the sidebar for the event itself?

All that code should do is allow you to select one of your simple sidebars on the event, since it is tied to the registration of the event custom post type. Adding a simple sidebar to a category might be different. t

Without looking at more of the plugin code, that's all I can do. If you provide a link, I can try it on a site where I have simple sidebars set up.
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom post type post info link to post type parent taxonomy stl99 General Discussion 3 03-16-2012 06:31 AM


All times are GMT -5. The time now is 05:54 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.