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

    Hi,

    I am using this function but the output appears on top of the page right after #main is opened and not in the element I placed the shortcode.
    What is wrong with the code?

    function evenementen() {
    $today = current_time('Ymd');
    $args = array(
        'post_type' => 'evenementen',
        'posts_per_page' => '4',
        'meta_key'  => 'datum_evenement',
        'order' => 'DESC',
        'orderby' => 'meta_value',
        'meta_query' => array(
          array(
                'key'   => 'datum_evenement',
                'compare' => '>=',
                'value'   => $today,
            ),
        ),
    );
    
    $children = new WP_Query($args);
    ?>
    
    <?php if ($children->have_posts()) : ?>
      <?php while ($children->have_posts()) : $children->the_post(); $fields = (object) get_fields(); ?>
        <div class="event row">
          <div class="event-logo col-sm-4">
            <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'large', array( 'class' => 'img-responsive' ) ); ?></a>
          </div>
          <div class="event-details col-sm-8">
            <h3 class="underline"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
            <h5><?php the_field('datum_evenement'); ?></h5>
            <p class="call-to-action"><a href="<?php the_permalink(); ?>">Read More</a></p>
          </div>
        </div>
      <?php endwhile; wp_reset_postdata(); ?>
    <?php endif; ?>
    <?php
    
    } add_shortcode('nm2d_evenementen', 'evenementen');
    #1139443

    Hey (Email address hidden if logged out) ,

    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,
    Vinay

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

You must be logged in to reply to this topic.