[Support request] Query Loop or Query not pulling Events data in backend

Home Forums Support [Support request] Query Loop or Query not pulling Events data in backend

Home Forums Support Query Loop or Query not pulling Events data in backend

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2388609
    Jenni

    Working on a new site with GP Premium and GenerateBlocks Pro installed.
    On the back end when creating a new Query Loop with Events post type it shows “No Posts Found”
    Tested all plugins, cleared all caches. Tried some additional plugins, and a different theme to see if it was just GP. I can’t figure it out!
    Oddly, it DOES show a post on the front end. But since I can’t see the blocks of the query loop, I can’t edit.
    https://staging.greenvalleygardeners.com/ (“Green Thumb” halfway down)

    I also don’t see any Events Blocks except when created an events post and I would like this Query to show the event date, not the post date. Is that expected behaivor?

    I am fairly new to QueryLoop so it is likely user error. Do I have a setting wrong? Site info attached.

    #2388636
    Ying
    Staff
    Customer Support

    Hi there,

    I checked your query loop block, it uses the GB query loop block but with WP’s blocks to represent the content, that looks weird.

    Can you provide admin login so we can take a look at the back end?

    And how did you create this CPT event? Via a plugin?

    #2388850
    Jenni

    Opps I was getting creative in trying to make it work.

    I did another one with a QueryLoop with no edits. Same problem.

    Yes, using Events Calendar Plugin.

    #2389429
    David
    Staff
    Customer Support

    Hi there,

    the Events Calendar plugin has quite a few proprietary functions which may explain why they do not preview in the editor.
    Regarding the date. that plugin doesn’t store it as the Published date, but in some custom class that requires there function to retrieve. For reference here is that function:

    https://docs.theeventscalendar.com/reference/functions/tribe_get_start_date/

    So it would be possible to swap the post date for the start date, but it would require some code, Happy to give that a try.

    But before doing so, does the Event plugin provide a method to do what you require on the home page ? As styling that to look how you want may be easier then trying to build it with a query loop.

    let me know

    #2390284
    Jenni

    Yes, if I can get the event date instead, that will work.
    I will attempt this! So I guess the problem is really Event Calendar’s to try to fix. I’ve been able to use Show Post for events on other sites…but was trying to be proactive and learn QueryLoop.

    Is there another calendar plugin that works more seamlessly that you all recommend? New site! I can switch!
    Thanks

    #2391150
    David
    Staff
    Customer Support

    I don’t have an event calendar alternative recommendation. The Tribe plugin is the one we see most commonly used.

    1, Ok, if you remove any Query Loop blocks so we can start afresh.

    2. Add a GenerateBlocks Query Loop, and use the Headline Block to add the post tile.

    3. Then for the date, and another headline block, with just a static string of text eg. Event Date.
    3.1 With that block selected go Advanced > Additional CSS Class(es) and add: event-date

    4. Save the page.

    You should see on the front end just the post title and the Event Date string

    5. Now add this PHP Snippet, it will look for the block with the event-date class and swap it for the event date.

    
    add_filter( 'render_block', function( $block_content, $block ) {
    
        global $post;
        $eventDate = tribe_get_start_date($post->ID, true, $format = 'F j, Y - l' );
        if ( 
            !is_admin()
            && is_single()
            && ! empty( $block['attrs']['className'] ) 
            && 'event-date' === $block['attrs']['className']  
            && $eventDate
        ) {
    		
            $block_content = $eventDate;
    
        }
    
        return $block_content;
    
    }, 10, 2 );

    Fingers crossed 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.