Forums

[resolved] Scope of "The Loop" using Event Calendar EC3 (10 posts)

  1. jose
    Member
    Posted 2 years ago #

    Is "The Loop" limited to out-of-the-box WP post data or can it bring in data attached to posts from plug-ins (specifically Event Calendar EC3)?

    If it can, then how do you do it?

    Thanks.

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    The loop can be used for other 'post_types' if that plugin does that. See query_posts()

  3. jose
    Member
    Posted 2 years ago #

    Not sure how to do it after looking at query_posts()

  4. MichaelH
    Volunteer
    Posted 2 years ago #

    Doesn't event calendar 3 put events in a particular category. If so, assuming you call that category "Events" just use this:

    <?php
    $cat_id = get_cat_ID('Events');
    $args=array(
      'cat' => $cat_id,
      'post_type' => 'post',
      'post_status' => 'publish',
      'posts_per_page' => -1,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      echo 'List of Events';
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
        <?php
      endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>
  5. jose
    Member
    Posted 2 years ago #

    Thanks MichaelH, I really appreciate your help as I get my arms and mind around WP.

    Your code produces the same results that my code does -- I use get_posts() with a foreach() loop.

    What I can't retrieve is the Event Calendar's Event Date. The date that continues to come back from the extract is the date of the post and not the date from the EC3 plug-in.

    There is no real good doc on the EC3 plug-in and my forum posts and listserv requests continue to go un-answered.

    There has to be a way to get this ... but I am too much of a newbie at this time to solve it.

  6. MichaelH
    Volunteer
    Posted 2 years ago #

    Either of these two lines work (put just before that endwhile;

    echo ec3_get_schedule('%s; ','%1$s %3$s %2$s. ','[ %s] ');
    ec3_the_schedule();

    Found at that plugins homepage under Template Functions

    Note that the schedule data is kept in the ec3_schedule file in your WordPress database so if you don't like the functions the plugin offers, then use wpdb to access that table.

  7. jose
    Member
    Posted 2 years ago #

    Awesome MichaelH...thanks. I can work with this now.

  8. jose
    Member
    Posted 2 years ago #

    MichaelH,

    then use wpdb to access that table.

    I can't get this to work. I must be missing something in order to get my following line of code to work:
    $myrows = $wpdb->get_results('SELECT table_date FROM my_table WHERE id="'.$id.'" LIMIT 1');

  9. jose
    Member
    Posted 2 years ago #

    I figured it out

  10. Lucasmendes
    Member
    Posted 1 year ago #

    Could you tell me how did you figured it out? :)

Topic Closed

This topic has been closed to new replies.

About this Topic