![]() |
|
||||||
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
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:
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
|
|||
|
|||
|
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
|
|||
|
|||
|
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 | |
|
|
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 |
© Copyright 2012 Copyblogger Media LLC · StudioPress™ is a trademark of Copyblogger Media LLC
Privacy Policy | Refund Policy | Terms of Service | Affiliate Program | Contact Us