Sunny Bains

Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • in reply to: Adding a custom taxonomy or event meta filter #1147564
    Sunny Bains
    Participant

    I haven’t been able to try this today and I’m now away for a week. Can we keep this open so I can pick it up when I get back.

    I would like to know, when using remove action what global variable is assigned to the class Tribe__Events__Query?

    in reply to: Accessing Tooltip pop-ups on home page. #1147492
    Sunny Bains
    Participant

    It still didn’t work, but we don’t need them now as we’ve done something else for the pop-ups.

    in reply to: Adding a custom taxonomy or event meta filter #1146946
    Sunny Bains
    Participant

    I had reviously tried hooking one tribe_events_pre_get_posts which didn’t work. I have also now tried hooking to both but still it doesn’t work.

    Is there an easy way for me to override function pre_get_posts in /the-events-calendar/src/Tribe/Query.php?

    in reply to: Adding a custom taxonomy or event meta filter #1146482
    Sunny Bains
    Participant

    Digging deeper into this, the reason it works sometimes and not if I use the next/previous links is the function ‘pre-get_posts’ in /the-events-calendar/src/Tribe/Query.php overwrites my meta_query rather than adding to it.

    If I move assigning the query from functions.php to /the-events-calendar/src/Tribe/Query.php all is well.

    The code I have added to Query.php at line 347 (after the block commeted as ‘hide upcoming events from query (only not in admin)’):

    if ( !Tribe__Admin__Helpers::instance()->is_screen( 'edit-tribe_events' ) ) {
    	// Filter out any cancelled events
    	$meta_query[] = array(
    		'key' 	   => get_event_custom_field_key('Event Cancelled'),
    		'value'    => 'Yes',
    		'compare'  => '!=',
    	);
    }

    since this is a core plugin file is there any way I can override this so that upgrades will still work without breaking the changes?

    • This reply was modified 7 years, 9 months ago by Sunny Bains.
    in reply to: WP Menus do not appear on WP Events Calendar Pages #1146480
    Sunny Bains
    Participant

    I found the issue with this:

    In adding a custom tax query in functions.php I was excluding the filter for archive type rather than post type … all sorted now.

    in reply to: Adding a custom taxonomy or event meta filter #1146014
    Sunny Bains
    Participant

    Looking a little more into this is seems to be specificly related to the ‘Next/Previous Week/Month’ links.

    If I access a calendar page by linking to the URL directly, or typing it, or by switching between the week/month views then it works fine. If get to the page using the next/previous links then the events that were excluded by ‘pre_get_posts’ are still visible UNTIL I refresh the page. Also use of the browsers back button causes the filtered events to still be visible.

    If you want to see this happening I can share HTTP access details for the developemnt site to you privately.

    in reply to: Adding a custom Notice … #1146010
    Sunny Bains
    Participant

    Thanks, I added a little extra code to retain any existing notices (e.g. no events found) but that works a treat.

Viewing 7 posts - 1 through 7 (of 7 total)