Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1057387

    Hi,

    I’m using ACF PlugIn for custom events. What I want is to show future events with the help of a shortcode inside the Avia builder. Unfortunately the loop is always shown at the beginning of the page, not at the position of the shortcode. What am I doing wrong?

    <?php
    
    /* -------------------------------------------------------------
    	SHORTCODE FUTURE EVENTS
    ------------------------------------------------------------- */
    
    function future_events_all_shortcode() {
    
    // Begin Function
    
    $today = current_time('Y-m-d');
    $args = array(
        'post_type' => 'veranstaltungen',
        'posts_per_page' => '20',
        'meta_key'  => 'datum_beginn',
        'order' => 'ASC',
        'orderby' => 'meta_value',
        'meta_query' => array(
          array(
                'key'   => 'datum_beginn',
                'compare' => '>=',
                'value'   => $today,
            	'type' => 'DATETIME'
            ),
        ),
    );
    
    // Format date
    $date = get_field('datum_beginn');
    $date_day = date_i18n("D", strtotime($date));
    $date_day_digit = date_i18n("d", strtotime($date));
    $date_month = date_i18n("M", strtotime($date));
    
     
    $children = new WP_Query($args);
    
    if ($children->have_posts()) :
    	while ($children->have_posts()) : $children->the_post(); $fields = (object) get_fields();
        
        echo '<div class="atomic-events">';
    	    
    	    echo '<div class="atomic-event">';
    	    	
    	    	echo '<div class="event-date">';
    				echo '<div class="event-date-day">', $date_day, '</div>';
    				echo '<div class="event-date-day-digit">', $date_day_digit, '</div>';
    				echo '<div class="event-date-month">', $date_month, '</div>';
    			echo '</div>'; // end event-date
    			
    			echo '<div class="event-text">';			
    				echo '<h1 class="event-title"><a href="' , the_permalink() , '">' , the_title() , '</a></h1>';
    			echo '</div">'; // end event text
    			
    			echo '<div class="event-image">';			
    				echo '<div class="event-image"><a href="' , the_permalink() , '">' , the_post_thumbnail( 'large', array( 'class' => 'img-responsive' ) ) , '</a></div>';
    			echo '</div">'; // end event image
    			
    	    echo '</div>'; // end event
    	
    	echo '</div>'; // end events
    	
     	endwhile; wp_reset_postdata();
    endif;
    
    // End Function
    
    }
    add_shortcode('future_events', 'future_events_all_shortcode');
    #1058370

    Hey conflock,

    Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)

    Best regards,
    Basilis

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