• Resolved erick.dhaene

    (@erickdhaene)


    listé uniquement les événements qui appartiennent à deux catégories à la fois/listed only events that belong to both categories at once

    Bonjour je souhaite créer une page qui liste les événements qui appartiennet à la fois à la catégorie qui posséde l’ID 16 et à la catégorie qui posséde l’ID 24;
    que ce soit avec

    $events = eo_get_events(array(
                        'numberposts'=>-1,
                        'tax_query'=>array( array(
                             'taxonomy'=>'event-category',
                             'operator' => 'IN',
                             'field'=>'slug',
                             'terms'=>array('photos','enfance'),
    			 'orderby'=>'date',
    			 'order'=>'DESC'
                             ))));?>

    ou cette méthode

    $query = new WP_Query('ec3_after=today&posts_per_page=5&cat=16,24&order=dsc' );
     if ($query->have_posts())

    j’obtiens les événements qui appartiennent aux deux catégories et non pas “seulement les événements qui appartiennent aux deux catégories à la fois” comment puis-je faire cela ?
    Cordialement.

    Hello I want to create a page that lists the events that appartiennet both the category that has the ID 16 and the class that has the ID 24;
    whether with

    $events = eo_get_events(array(
                        'numberposts'=>-1,
                        'tax_query'=>array( array(
                             'taxonomy'=>'event-category',
                             'operator' => 'IN',
                             'field'=>'slug',
                             'terms'=>array('photos','enfance'),
    						 'orderby'=>'date',
    						 'order'=>'DESC'
                             ))));?>

    or this method

    $query = new WP_Query('ec3_after=today&posts_per_page=5&cat=16,24&order=dsc' );
     if ($query->have_posts())

    I get the events that belong to two categories and not “only events that belong to both categories at once” how can I do this?
    Cordially.

    https://www.ads-software.com/plugins/event-organiser/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Stephen Harris

    (@stephenharris)

    Hi Erick,

    Only the first of those two snippets are correct. The latter has an attirubte ec3_after (which I think might be from a different plug-in ?? ). The cat also refers to post categories not event categories.

    As for getting events which are in both terms, see the examples listed on this page. In short you need to split it into two tax queries and set the relation to ‘AND’. See, for example, the second snippet down from the “Multiple Taxonomy Handling” section in the above link.

    Thread Starter erick.dhaene

    (@erickdhaene)

    C’est bien ?a, je parle d’event organiser :-S désolé pour le dérangement …
    Merci à toi.

    That’s right, I’m talking to event organiser :-S sorry for the inconvenience … Thank you to you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘listé uniquement les événements qui appartiennent à deux catégories à la fois’ is closed to new replies.