we are using the CiviEvent Widget, I’m struggling to figure out how to display a list of event ids, but not others using shortcode. I would like for example to list events of id 9,10,11 exclusively. I've tried seperating the id's by coma, semi-colon etc... but have had no success, it usually just displays the first id number i list.

Thanks for your help

  • I am not sure that is possible - but someone from AGH may know.
    – themak
    Feb 3 '20 at 22:01

The document says you add custom filters on shortcode

try adding

[civievent_widget custom_filter='{"start_date":{"IS NOT NULL":1},"id":{"IN":[9,10,11]},"is_public":1,"options":{"sort": "start_date ASC"}}' admin_type="custom" custom_display='{"event_title_infolink":{"title":0,"prefix":null,"suffix":null,"wrapper":1},"description":{"title":1,"prefix":null,"suffix":null,"wrapper":1}}' limit=5] 

Also you will need to amend the patch below to decode html entities

diff --git a/civievent-widget.php b/civievent-widget.php
index e973ce0..c3c2da4 100644
--- a/civievent-widget.php
+++ b/civievent-widget.php
@@ -223,7 +223,7 @@ class civievent_Widget extends WP_Widget {
                                $standardDisplay = true;
                        } else {
                                // Get custom filters.
-                               $customFilters = json_decode( CRM_Utils_Array::value( 'custom_filter', $instance, '' ), true );
+                               $customFilters = json_decode(html_entity_decode(CRM_Utils_Array::value( 'custom_filter', $instance, '' )), true );
                                $filterParams = array(
                                        'start_date' => array( '>=' => date( 'Y-m-d' ) ),
                                        'is_public' => 1,
  • Just tried: [civievent_widget admin_type="custom" '{"id": {"IN": [9,10,11]}}' limit=10], but sadly without success
    – user7275
    Feb 4 '20 at 0:54
  • Sorry, that should have read, this is what i tried unsuccesfully: [civievent_widget admin_type="custom" custom_filter='{"id": {"IN": [9,10,11]}}' limit=10]
    – user7275
    Feb 4 '20 at 1:03
  • you need to pass custom_filter, admin_type, custom_display Feb 4 '20 at 2:09
  • Thanks for your help Ppradeep; I've tried your above suggestion. It's showing 5 events (sadly not limited to the right ID's) , and then the remaining part of the string below those 5 events: },”is_public”:1,”options”:{“sort”: “start_date ASC”}}’ admin_type=”custom” custom_display='{“event_title_infolink”:{“title”:0,”prefix”:null,”suffix”:null,”wrapper”:1},”description”:{“title”:1,”prefix”:null,”suffix”:null,”wrapper”:1}}’ limit=5] Your help is really appreciated.
    – user7275
    Feb 4 '20 at 2:35
  • 1
    I think wp short code doesn't support square bracket inside it unless there is a way Feb 4 '20 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.