Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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?

    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' );
    • This reply was modified 3 years, 2 months ago by laurenturkois.
Viewing 2 replies - 1 through 2 (of 2 total)