Support » Fixing WordPress » Scope of “The Loop” using Event Calendar EC3

  • Resolved jose

    (@dkozar)


    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.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The loop can be used for other ‘post_types’ if that plugin does that. See query_posts()

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

    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().
    ?>

    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.

    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.

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

    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');

    I figured it out

    Could you tell me how did you figured it out? 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Scope of “The Loop” using Event Calendar EC3’ is closed to new replies.