Home › Forums › Calendar Products › Events Calendar PRO › Showing all events despite the 'Hide From Event Listings' being checked
- This topic has 13 replies, 4 voices, and was last updated 9 years, 1 month ago by
Chad.
-
AuthorPosts
-
January 31, 2017 at 9:31 am #1226991
Chad
ParticipantHi,
I’m trying to show all events of a category, despite the ‘Hide From Event Listings’ being checked. I know this code works when ‘Hide From Event Listings’ is unchecked. Could somebody be able to help figure out how to make this work even when ‘Hide From Event Listings’ is checked?
$events = tribe_get_events( array( 'eventDisplay' => 'list', 'posts_per_page' => 3, 'tax_query' => array( array( 'taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => $group_slug, ), ), 'meta_query' => array( array( 'key' => '_EventHideFromUpcoming', 'compare' => 'NOT EXISTS', 'value' => 'yes', ), ), ) );February 1, 2017 at 12:54 pm #1227787Andras
KeymasterHey Chad,
Thanks for reaching out!
Although I don’t have a straight answer to you, but you need to tinker around with the second part with the meta_query array. Maybe event totally remove that, so it doesn’t even check for the ‘hide’ setting. I believe then it should show events regardless of that setting.
Check and let me know if that solves it for ya.
Cheers,
AndrasFebruary 2, 2017 at 8:50 am #1228318Chad
ParticipantNo, leaving out the meta_query and/or the tax_query array doesn’t seem to solve it. To me it looks like by default the tribe_get_events function takes the ‘Hide From Event Listings’ into consideration. I would like to show all events coming up, regardless of the ‘Hide From Event Listings’ is checked or not.
February 3, 2017 at 7:33 am #1228899Andras
KeymasterHey Chad,
Okay, I looked up how WP Query works and did some tweaks to your code.
I didn’t test it, but in theory it should work, or at least take you a step ahead. Here it is:
https://gist.github.com/andrasguseo/c01c096d39c495295efc4cafcffea790
Let me know if you make progress.
Cheers,
AndrasFebruary 3, 2017 at 7:33 am #1228900Andras
KeymasterThis is the page where I was looking for help:
https://codex.wordpress.org/Class_Reference/WP_Meta_Query
A.
February 3, 2017 at 8:08 am #1228915Chad
ParticipantThank you for taking the time to help out, but it still doesn’t work.
I looked in the database and when the ‘Hide From Event Listings’ is checked it creates an entry in the meta_post table as “_EventHideFromUpcoming” with a “yes”. If that is not checked than that entry doesn’t exist (it deletes it when you uncheck it again).
Can I somehow print out the SQL Query that the plugin executes with tribe_get_events()? This way I can see what is going on and if it actually takes the meta_query in consideration.
February 6, 2017 at 2:04 am #1229834Andras
KeymasterHi Chad,
Sorry that didn’t do it. I wasn’t sure how that value is handled in the db, thanks for checking. I tweaked the code a bit to math that. Now basically it should check if that entry is “Yes” or doesn’t exist.
https://gist.github.com/andrasguseo/c01c096d39c495295efc4cafcffea790
And you can use var_dump() to print out the query.
Let me know if this helps.
Cheers,
AndrasFebruary 6, 2017 at 8:19 am #1230006Chad
ParticipantNope, still doesn’t work.
Its almost like the ‘meta_query’ part just gets ignored. var_dump($events) only gives me ‘array(0) { }’. I want to see the actual MySQL query so I can see what is going on on.
Thanks!
February 7, 2017 at 4:01 am #1230446Andras
KeymasterSorry to hear that didn’t help.
For checking the queries you can try the Query Monitor plugin for that. It is a tool we also use sometimes.
Andras
February 7, 2017 at 7:54 am #1230586Chad
ParticipantIt would be great if the developers of this plugin would actually take the time to see if they can re-create this issue, rather than guessing based on what I’m talking about. We already know how the plugin stores the data in the database, somebody (who knows the plugin very well) needs to check if the tribe_get_events() function is taking the ‘meta_query’ array into consideration properly or not. Thats out of my area of knowledge.
Thank you!
February 8, 2017 at 12:15 pm #1231595Andras
KeymasterHi Chad,
Thank you for your feedback!
Per our terms and conditions we support features of the plugins and although we try to help get you started on customizations for the most part you are going to have to take it on to complete.
Despite this I was giving you information, direction and resources as well.
Currently we are a bit swamped and just before a maintenance release, but I’ll see if I can get someone to take a look at this. I ask for your kind patience.
Thanks for your understanding.
Cheers,
AndrasFebruary 15, 2017 at 2:52 pm #1236524Andras
KeymasterHello Chad,
Thanks for your patience!
You could setup and tear down a filter immediately before/after the custom query, in order to stop the hide-upcoming logic from kicking in. Basic approach would be:
function undo_hide_upcoming_logic( $query ) { $query->set( 'hide_upcoming', false ); } // Setup workaround add_action( 'tribe_events_pre_get_posts', 'undo_hide_upcoming_logic' ); // Run custom query $events = tribe_get_events( array( /* Custom params */ ) ); // Teardown workaround remove_action( 'tribe_events_pre_get_posts', 'undo_hide_upcoming_logic' );Note that this is just an untested outline, but should give you the basic idea.
Does this help?
Andras
March 9, 2017 at 8:35 am #1251816Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Showing all events despite the 'Hide From Event Listings' being checked’ is closed to new replies.
