• Resolved laurenturkois

    (@laurenturkois)


    Hello all,

    Main issue: It appears that The Events Calendar modifies the database queries when ACF tries to load events using the Relationship field.

    I have set up an ACF relationship field which should allow me to select events to feature on my homepage using Beaver Builder. However, when I select events and click Update, the posts are disappear from the selected column (please see video here).

    I just so happen to also create a custom feed using the posts selected (I call it featured events). In the video, you can see the selected posts are successfully registered, but they are not visible in the ACF Relationship field.

    The second issue: The ACF Relationship items do not load in the Beaver Builder post module.

    The key for my ACF Relationship is featured_events. When I use this key to set the content in my Beaver Builder post module, nothing loads.

    Findings: When I change the post type in the ACF Relationship settings (aka change the relationship to load Posts instead of Events) everything works as expected. I.e. posts are listed in the selected column of the relationship field, and they load successfully in the Beaver Builder module. This means there is definitely a conflict with The Events Calendar because Events are the only post type that does not work.

    I have already reached out to ACF regarding this issue. After they replicated it on their end and verified there is a conflict between ACF and TEC, they suggested reaching out to TEC as it will need to be code changes their end to fix. I am using the most up-to-date versions of TEC (5.12.3), Beaver Builder Theme – I’m using the child theme (1.7.10), Beaver Builder (2.5.1.1), and ACF Pro (5.11.4). There are no console errors or theme overrides. Any help or assistance would be greatly appreciated.

    Thank you in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Same issue here. Since there hasn’t been a reply yet, a temp solution that worked for me is also select another post type in your ACF field.

    Seems to only happen when only tribe_events is used as post type lookup. Adding another post type to select from (even though you don’t need it) fixed the problem for me anyway. Not a solution, but a workaround for now.

    Good luck you ya.

    Thread Starter laurenturkois

    (@laurenturkois)

    Thanks @scotttrsar , this worked for displaying the selected events in the ACF Relationship box, however I’m still unable to query for the selected posts using Beaver Builder or a basic ACF function (code below). I believe this is the main issue that ACF mentioned needs to be fixed on TEC’s side. Were you able to display the selected posts?

    // Display Featured Events ACF Relationship
    function ecob_featured_events_relationship(){
    	$featured_events = get_field('featured_events');
    	if( $featured_events ): ?>
    		<ul>
    		<?php foreach( $featured_events as $featured_event ): 
    			$permalink = get_permalink( $featured_event->ID );
    			$title = get_the_title( $featured_event->ID );
    			?>
    			<li>
    				<a href="<?php echo esc_url( $permalink ); ?>"><?php echo esc_html( $title ); ?></a>
    			</li>
    		<?php endforeach; ?>
    		</ul>
    	<?php endif;
    }
    add_shortcode( 'featured-events', 'ecob_featured_events_relationship' );

    I haven’t run into this issue, though I’m not using beaver builder. The only issue I noticed was getting the field value to display in the admin after save.

    However, looking at your shortcode example, you don’t seem to be returning anything. Could be why nothing is displaying for you.

    Give this a shot:

    function ecob_featured_events_relationship(){
    	$featured_events = get_field('featured_events');
    	if( $featured_events ): ?>
    	  <?php ob_start(); ?>
    		<ul>
    		<?php foreach( $featured_events as $featured_event ): 
    			$permalink = get_permalink( $featured_event->ID );
    			$title = get_the_title( $featured_event->ID );
    			?>
    			<li>
    				<a href="<?php echo esc_url( $permalink ); ?>"><?php echo esc_html( $title ); ?></a>
    			</li>
    		<?php endforeach; ?>
    		</ul>
    		<?php return ob_get_clean(); ?>
    	<?php endif;
    }
    add_shortcode( 'featured-events', 'ecob_featured_events_relationship' );
    Thread Starter laurenturkois

    (@laurenturkois)

    Both before and after adding <?php return ob_get_clean(); ?> my shortcode successfully returns an unordered list, but unfortunately the permalink and title displayed match the page (not the selected posts). It looks like this with the homepage permalink on each:

    • Home
    • Home
    • Home

    I also find it interesting that the query recognizes I have selected three posts, yet it does not grab the posts information. It still looks like The Events Calendar modifies the database queries when ACF tries to load events using the Relationship field. @scotttrsar How are you displaying your relationship successfully?

    This is no longer on topic with the admin field and ACF, but you’re most likely only pulling in the post id’s then in your field settings. If this is the case, you don’t need $featured_event->ID. I’d just be $featured_event.

    If you want to troubleshoot a bit easier I would recommend learning about some debugging tactics and using php functions such as print_r or var_dump.

    // See the field data before you start looping it.
    print_r($featured_events); exit;

    This doesn’t appear to be any issue with the actual plugin code.

    However, the issue of ACF and TEC still exists when a post object or relationship field is set to post type tribe_events only.

    Plugin Support Abz

    (@abzlevelup)

    Hi @scotttrsar and @laurenturkois,

    We do appreciate the feedback and comments on how to troubleshoot the issue here, it is noteworthy — thanks for sharing. Please do update the plugins to the latest version.

    It seems like this thread gone quiet, and there are no further activities. We assume that this is already fixed or no longer applicable. I would mark this as resolved for now.

    If that is not the case, please let me know, and I will gladly remove the “Resolved” tag and try to help you further. Or you can create a new topic with the issue if you prefer.

    Best,
    Abz

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘ACF Relationship Field & TEC Events Post Type’ is closed to new replies.