WordPress.org

Ready to get started?Download WordPress

Forums

All-in-One Event Calendar
[resolved] Custom Query to homepage (7 posts)

  1. michaelalbee
    Member
    Posted 2 years ago #

    So I've been messing with this for hours and hours and hours ...

    I have a custom homepage where I want to pull the next upcoming event in an event category. I'll admit I know this is a hack job but I've tried everything ... HELP!

    '<?php
    global $ai1ec_calendar_helper, $ai1ec_events_helper;
    $bits = $ai1ec_events_helper->gmgetdate( $ai1ec_events_helper->gmt_to_local( time() ) );
    $start_time = $ai1ec_events_helper->local_to_gmt( $now );
    $end_time = $ai1ec_events_helper->local_to_gmt( $end_time );
    $now = $ai1ec_events_helper->local_to_gmt( time('D, M d Y H:i:s') );

    // The New Events Query
    $args = array(
    'posts_per_page' => 1,
    'paged' => get_query_var('paged'),
    'post_type' => 'ai1ec_event',
    'cat_ID' => '40',
    'orderby' => 'date',
    'order' => 'ASC',
    'post_status' => 'publish',

    );

    $events_added = new WP_Query( $args );
    // The Loop
    while ( $events_added->have_posts() ) : $events_added->the_post();

    $event = Ai1ec_Calendar_Helper::get_events_between($now, $end_time, $filter, $spanning = false);

    ?>

  2. " href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail('home-features'); ?>
    <?php the_excerpt(); ?>
    <h2>

    " href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?> </h2>

  3. <?php

    endwhile;

    // Reset Post Data
    wp_reset_postdata();
    ?>
    '

    http://wordpress.org/extend/plugins/all-in-one-event-calendar/

  • michaelalbee
    Member
    Posted 2 years ago #

  • shrmn
    Member
    Posted 2 years ago #

    Have you tried the following shortcodes listed here?

    http://wordpress.org/extend/plugins/all-in-one-event-calendar/faq/

    Exactly which part of the homepage would you like this to appear?

  • michaelalbee
    Member
    Posted 2 years ago #

    It is a custom homepage ... unfortunately using the shortcodes doesn't allow me to pull the information that I'm wanting.

    Basically the idea is to pull the same information that I'm pulling for the other

  • I have one for each category pulling the most recent post with a thumbnail, excerpt, and title.

    You can see above that the third column should be the "event" area ... I can even get it to pull the excerpt and the featured image... but it pulls the last one posted not the next upcoming event. which is what I'm wanting.

    ideas?!?!

  • shrmn
    Member
    Posted 2 years ago #

    Sorry, I can't make out the content of the thread because the formatting is bad :(

    Could you please edit your first post and put your code in a code box?

  • michaelalbee
    Member
    Posted 2 years ago #

    So I've been messing with this for hours and hours and hours ...

    I have a custom homepage where I want to pull the next upcoming event in an event category. I'll admit I know this is a hack job but I've tried everything ... HELP!

    http://pastebin.com/zkKwfjRX

    It is a custom homepage ... unfortunately using the shortcodes doesn't allow me to pull the information that I'm wanting.

    Basically the idea is to pull the same information that I'm pulling for the other I have one for each category pulling the most recent post with a thumbnail, excerpt, and title.

    http://jmathewinc.com/guest/category_screen.jpg

    You can see above that the third column should be the "event" area ... I can even get it to pull the excerpt and the featured image... but it pulls the last one posted not the next upcoming event. which is what I'm wanting.

    ideas?!?!

  • michaelalbee
    Member
    Posted 2 years ago #

    Moved to better formatted thread

  • Topic Closed

    This topic has been closed to new replies.

    About this Plugin

    About this Topic

    Tags