Event Category for wordpress plugin

Hi,

i’d like to organize the events in a kind of category - and change the css-styles later on.
could i do this via event options and if so, how?

any kind of a little howto would be great (which files do i have to edit f.e.).

I saw that other people asked more or less the same, but didn’t really understood the answers, sorry.

thanks in advance …

regs

peter

As for version 2.0 - there is no need for any code customization

  • Open Admin panel - Custom fields
  • Add new field “category”
  • Select type “select”
  • Add options with necessary category types
  • Save settings

After that , scheduler will have a category for each event.
Also, in the same custom fields form, you can define colors for different categories.

Thank you.
astonishing easy - thanks.

now a selector in the template would be great to see only the events of a certain category.

Cause I only know php, not js, is there a easy way to implement that in your code?
or - i’m asking for all of my luck of today at once :slight_smile: - is it already implemented?

regs
peter

It is not implemented, by it can be added by next steps

in
plugins\event-calendar-scheduler\codebase\dhtmlxSchedulerConfigurator.php
locate

$scheduler .= "</script>

and replace with

$scheduler .= " scheduler._filter_by = ''; scheduler.filter_day = scheduler.filter_week = scheduler.filter_month = function(id){ if (!scheduler._filter_by) return true; if (scheduler.getEvent(id).category == scheduler._filter_by) return true; return false; }; </script> <select onchange='scheduler._filter_by = this.value;scheduler.setCurrentView(scheduler._date);'><option value=''>All</option><option value='category_0'>Group A</option><option value='category_1'>Group B</option></select>

where “category” need to be replaced with name of your custom field.

GREAT!!
it works just “right out of the box”.
thanks a lot.
I just needed to be aware of lower/uppercase for event_option - must not use uppercase (we love that in germany :wink: ).

regs

peter

Yes! This does work great! The only way I can think that this would work better is if the for the filter selection menu were populated by reading what categories are available.

Since my client might want to set up a temporary set of categories (e.g. for a time-limited set of events) I’d rather not force them to hire me to manually modify the as described upthread.

Any suggestions on reading from the DB for populating the ?? Or should I give up on that? :confused:

-g

Maybe as part of the next version
Standalone version of scheduler has some built-in functionality, which can be used to manipulate with options list, but it requires not so simple coding, to achieve the same in case of plugins.

WOW, this works like a charm. Thank you!!! :smiley:

Is there anything else I need to do to display the filter?
My customfield name: “test”
Type: “List”
Options: “option0”, “option1”

$scheduler .= " scheduler._filter_by = ''; scheduler.filter_day = scheduler.filter_week = scheduler.filter_month = function(id){ if (!scheduler._filter_by) return true; if (scheduler.getEvent(id).test == scheduler._filter_by) return true; return false; }; </script> <select onchange='scheduler._filter_by = this.value;scheduler.setCurrentView(scheduler._date);'> <option value=''>All</option> <option value='option0'>option0</option> <option value='option1'>option1</option> </select>

Thanks for an amazing plugin


Modify your code like here:

<select onchange='scheduler._filter_by = this.value;scheduler.setCurrentView(scheduler._date);'>
            <option value=''>All</option>
            <option value='test_0'>option0</option>
            <option value='test_1'>option1</option>
         </select>

You should use construction {fieldname}_{index} for option values:
{fieldname} - ‘test’ in your case.
{index} - number of option starting from zero.

Nice thread all. I am using some of the tools mentioned in the posts and those are really good but I don’t know where to find the Wordpress company articles for read. We’ll try to throw this a reference on our Wordpress company blog. Ta
Wordpress Company

This is great - thanks!

I did one small adjustment to make it independent of the plugin files - so if I need to update DHTMLXscheduler I won’t overwrite the change. In an external javascript file, I added:

[code]jQuery(document).ready(function($){

//Create custom tabs on the top of the calendar for each Sala
scheduler.attachEvent("onTemplatesReady",function(){
	
	//Create the filters for the Calendar by Sala
	scheduler._filter_by = '';
	scheduler.filter_day = scheduler.filter_week = scheduler.filter_month = function(id){
	   if (!scheduler._filter_by) return true;
	   if (scheduler.getEvent(id).sala == scheduler._filter_by) return true;
	   return false;
	};
	
	//Create dropdown menu markup
	$dropdown_html  = "<select onchange='scheduler._filter_by = this.value;scheduler.setCurrentView(scheduler._date);' class='dropdown'>";
	$dropdown_html += "<option value=''>Todos</option>";
	$dropdown_html += "<option value='sala_0'>Escuela</option>";
	$dropdown_html += "<option value='sala_1'>Circo</option>";
	$dropdown_html += "<option value='sala_2'>Teatro</option>";
	$dropdown_html += "<option value='sala_3'>Sum</option>";
	$dropdown_html += "<option value='sala_4'>Música</option>";
	$dropdown_html += "<option value='sala_5'>JPC</option>";
	$dropdown_html += "</select>";
	
	//insert the Dropdown in the header of the calendar
	$('#scheduler_here .dhx_cal_date').after($dropdown_html);
	
});

});[/code]

Obviously, change anywhere that says “sala” to whichever custom type you’re working with.

Hi,

I’ve implemented this category sorting dropdown, but I’m also looking for a solution that would pull the custom fields automatically from the database. I need to allow my client to add/remove a custom field and for the sorting dropdown to automatically update. Any ideas?

If that’s not an option, when a custom field is deleted, is the category id# changed or does it stay the same? (ie. id category_0 is deleted, does category_1 become category_0 now, or stay the same?)

Thanks!