• Hello.
    When using EM_Calendar::output( $args ) in a template file, the plugins generate a list of event with pagination, etc…
    But I want to customise my list so I used $listEvents = EM_Events::get( $args );
    and then make a foreach loop, no problem there.
    My arguments are: `$args = array(‘owner’ => false,
    ‘pagination’ => 1,
    ‘ajax’ => false,
    ‘orderby’ => ‘event_start_date,event_start_time,event_name’ ,
    ‘order’ => ‘ASC’ ,
    ‘scope’ => ‘future’ ,
    ‘limit’ => ‘9’,
    );`
    But how can I paginate, I can’t find any exemple in the code or the templates…

    Here is my loop also:

     foreach ($listEvents as $event): ?>
                            <div class="column column-block">
                                <article  id="post-<?php echo $event->post_id; ?>" class="boutique text-center">
                                    <header>
    						            <?php if($event->image_url)
    							            $imageurl = $event->image_url;
    						            else
    							            $imageurl = get_field('image_par_defaut_pour_les_nouvelles','option')['sizes']['large'];
    						            ?>
                                        <a href="<?php echo get_permalink($event->post_id);?>">
                                            <img class="featured-thumb" src="<?php echo $imageurl;?>" alt="<?php echo $event->event_name;?>"/>
                                        </a>
                                        <h3 class="entry-title"><a href="<?php echo get_permalink($event->post_id);?>"><?php echo $event->event_name; ?></a></h3>
                                    </header>
                                </article>
                            </div>
                            <?php endforeach; ?>

    Thanks for your time.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    using EM_Events::get() you might need to do it using custom coding; you can see EM pagination code under events-manager/em-functions.php

    Thread Starter dantahoua

    (@dantahoua)

    Ok thanks!
    Is there also a function to “transform” the result of EM_Events::get() into “regular” post to be able to use the usual wordpress function? I get yes as the events can be shown in a regular archive page…

    I’m pretty sure you can use query_posts() with a custom post type.

    Thread Starter dantahoua

    (@dantahoua)

    Oh yeah! Thanks a lot! Sometimes, I don’t see the simplest solution…

    Thread Starter dantahoua

    (@dantahoua)

    Ok, when using a query_post(), how can I get the “start-date” or the “end-date” of the event as the object returned by wordpress is a standard post object, so missing the “event” variable…

    Thread Starter dantahoua

    (@dantahoua)

    I answer to my last question, seems everything is in Post_Meta so you could retrieve them by get_post_meta($post->ID).

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Can find how to paginate myself in template’ is closed to new replies.