Support » Plugin: Events Manager » post_category don’t work as filter

  • I try it than this example:
    http://wp-events-plugin.com/tutorials/using-additional-custom-taxonomies/

    functions.php:

    function my_em_own_taxonomy_register(){
    register_taxonomy_for_object_type(‘category’,EM_POST_TYPE_EVENT);
    register_taxonomy_for_object_type(‘category’,EM_POST_TYPE_LOCATION);
    register_taxonomy_for_object_type(‘category’,’event-recurring’);
    }
    add_action(‘init’,’my_em_own_taxonomy_register’,100);

    It works in the Event form but the Shortcode and the php code don’t work:

    [events_list post_category=”common”]
    echo EM_Events::output(array(‘post_category’ => ‘common’));

    I try it with the category id and the name.

    The following post categories are created:
    common -> 1
    ffw-public -> 4

    what is wrong?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    you need additional coding to make this work by creating custom search attributes – http://wp-events-plugin.com/tutorials/creating-custom-event-search-attributes/

    Thread Starter mchansy

    (@mchansy)

    Sorry I try it, but it don’t work. The $searches includes the attribute at the start of the get_default_search function with the right values. I thinnk it is not needed to include this code.

    Plugin Support caimin_nwl

    (@caimin_nwl)

    You need to use custom_category not category.

    Thread Starter mchansy

    (@mchansy)

    it is not the solution. I make a dump of the event’s in the hook add_filter('em_events_get','my_em_category_events_get',1,2);
    but I see not the category. If I edit the event I can see the category and change it.

    Plugin Support caimin_nwl

    (@caimin_nwl)

    If you are following the tutorial you linked to, you will definitely need to use custom_category not category. But then you’d also need to use custom_category throughout the rest of your code.

    Why did you change it?

    Thread Starter mchansy

    (@mchansy)

    I did not want to use my own taxonomy, I want category of normal posts. For this reason I tried the lower part of the tutorial. When using the post category, however, you should use the type post_category for searching or filtering. But this is not working.

    Plugin Support caimin_nwl

    (@caimin_nwl)

    You’re trying to do something that’s different from what the code in the tutorial in intended to do.

    It sounds like you’re trying to turn events into posts but that’s not possible.

    Thread Starter mchansy

    (@mchansy)

    The Tutoroila descript that I can register the post category to use with a event:

    Exceptions : Post Tags and Categories

    One final common example which has a slight twist – adding the normal posts category to your events and locations:
    1
    function my_em_own_taxonomy_register(){
    2
    register_taxonomy_for_object_type(‘category’,EM_POST_TYPE_EVENT);
    3
    register_taxonomy_for_object_type(‘category’,EM_POST_TYPE_LOCATION);
    4
    register_taxonomy_for_object_type(‘category’,’event-recurring’);
    5
    }
    6
    add_action(‘init’,’my_em_own_taxonomy_register’,100);

    Now your Events and Locations can assign and search for post categories. The twist is when using this in your search attributes, since we already use category and tag, you need to use post_category and post_tag instead.
    Using Custom Taxonomies in searches

    Once you’ve added the taxonomy to Events or Locations, it’s time to search! You can do this using shortcode or PHP. Here’s an example of both ways to search the post categories we added above.

    Shortcode:

    [events_list post_category=”featured,-hidden”]
    [locations_list post_category=”featured,-hidden”]

    And I do this. I can select the post category in the event this work fine. But I can’t use “post_category” (see the last shortcode discription) to show only the events for one or more post categories.

    Plugin Support caimin_nwl

    (@caimin_nwl)

    What output are you getting?

    Thread Starter mchansy

    (@mchansy)

    “Keine Veranstaltungen” -> no event found.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘post_category don’t work as filter’ is closed to new replies.