WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Display the events that are compliant with two categories at the same time (8 posts)

  1. joannarejdych
    Member
    Posted 5 months ago #

    Hi its me again :)

    I'm trying to set up the event display on my website. Currently I can only display the events as per chosen one category (e.g. just Recomended or just by Chosen City) and I would like to show the events that have marked two catgories (Recommended & Chosen city). Could you please tell me what would be the shortcode to tie these two categories so that I can only display the events that are compliant with both categories at the same time?

    I have tried but without any result:
    [events_list scope="future" category='71 and 145' limit=5 ][/events_list]
    [events_list scope="future" category='71 + 145' limit=5 ][/events_list]
    [events_list scope="future" category='149' category='71' limit=5 ][/events_list]

    I would be grateful for your support.

    https://wordpress.org/plugins/events-manager/

  2. angelo
    NetWebLogic Support
    Posted 5 months ago #

    try [events_list scope="future" category='71,145' limit=5 ]

  3. joannarejdych
    Member
    Posted 5 months ago #

    try [events_list scope="future" category='71,145' limit=5 ]

    it shows events from both categories. I need shortcode to display events which are marked with two categories.

    For example.
    I have:
    event no 1 - category 71, 82, 93
    event no 2 - category 71, 145, 99
    event no 3 - category 145, 99, 54
    event no 4 - category 43, 71, 145
    event no 5 - category 43, 56

    And I want to display only

    event no 2 and event no 4 because there are two categories (71, 145)

    when i use your shortcode it displays:
    event no 1, event no 2, event no 3, event no 4

    any ideas??

  4. philipjohn
    Member
    Posted 5 months ago #

    Hiya,

    There isn't the possibility to do it with that shortcode I'm afraid.

    You'd probably need to create your own shortcode to do that really, or hook into the output of the shortcode.

    THanks

  5. joannarejdych
    Member
    Posted 5 months ago #

    Hi, have you any idea how to do it? Example of shortcode or how to hook it?
    It is very important :-) and i am sure that it will be useful for others :)

  6. caimin_nwl
    NetWebLogic Support
    Posted 5 months ago #

    Unfortunately, we don't have any ready made examples but you'd need to use the standard WordPress add_shortcode function along with a custom query to get events that appear in the two categories.

    http://codex.wordpress.org/Function_Reference/add_shortcode

  7. joannarejdych
    Member
    Posted 5 months ago #

    So, i am wondering if there is someone who could write this code step by step for me. Of course I can pay for it as well because i am not fluent in php. Looking for your help :)

  8. angelo
    NetWebLogic Support
    Posted 5 months ago #

    you can try jobs.wordpress.net and try to check this tutorial - http://wp-events-plugin.com/tutorials/creating-custom-event-search-attributes/

    - you can call $events and then

    foreach($events as $event_key => $EM_Event){
      $categories = $EM_Event->get_categories();
      if ( !in_array($args['style'], $categories) ) {
        unset($events[$event_key]);
      }
    }

    *where [events_list style="71,145"]
    *not tested but something like this

Reply

You must log in to post.

About this Plugin

About this Topic