Title: WordPress Theme Functions In Calendar Theme
Last modified: August 21, 2016

---

# WordPress Theme Functions In Calendar Theme

 *  [larethian](https://wordpress.org/support/users/larethian/)
 * (@larethian)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/wordpress-theme-functions-in-calendar-theme/)
 * As the title suggest, I want to use some WordPress functions in a custom calendar
   theme, specifically:
 * get_avatar();
    get_the_post_thumbnail();
 * Is this possible?
 * [https://wordpress.org/plugins/all-in-one-event-calendar/](https://wordpress.org/plugins/all-in-one-event-calendar/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [cefiar](https://wordpress.org/support/users/cefiar/)
 * (@cefiar)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/wordpress-theme-functions-in-calendar-theme/#post-4867599)
 * For V2.0:
 * Currently, without editing the core plugin, no.
 * You can add these into …../all-in-one-event-calendar/lib/twig/ai1ec-extension.
   php as twig functions (you will see many examples in that file on how they work)
   and then access these through twig in a child theme.
 * For twig documentation, look at: [http://twig.sensiolabs.org/documentation](http://twig.sensiolabs.org/documentation)
 *  Thread Starter [larethian](https://wordpress.org/support/users/larethian/)
 * (@larethian)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/wordpress-theme-functions-in-calendar-theme/#post-4867643)
 * Well, I tried to work around learning twig by trying to use the loop in my template
   to iterate through the events.
 * This works, but I can’t seem to get the events into the right order, because 
   ai1ec stores the dates and times in an extra table in the database.
 * Which should work with a post_orderby filter.
 *  Thread Starter [larethian](https://wordpress.org/support/users/larethian/)
 * (@larethian)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/wordpress-theme-functions-in-calendar-theme/#post-4867654)
 * I tried this now in my loop:
 *     ```
       $querystr = "
       	SELECT $wpdb->posts.*
       	FROM $wpdb->posts
       	WHERE $wpdb->posts.post_type = 'ai1ec_event'
       	AND ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'draft' OR $wpdb->posts.post_status = 'revision')
       	INNER JOIN rwf_ai1ec_events ON (rwf_ai1ec_events.post_id = $wpdb->posts.ID)
       	ORDER BY rwf_ai1ec_events.end DESC
       ";
   
       $pageposts = $wpdb->get_results($querystr, OBJECT);
       ```
   
 * This doesn’t work – as soon as I try to join, I get no results in $pageposts.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘WordPress Theme Functions In Calendar Theme’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/all-in-one-event-calendar.svg)
 * [Timely All-in-One Events Calendar](https://wordpress.org/plugins/all-in-one-event-calendar/)
 * [Support Threads](https://wordpress.org/support/plugin/all-in-one-event-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/all-in-one-event-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/all-in-one-event-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/all-in-one-event-calendar/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [larethian](https://wordpress.org/support/users/larethian/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/wordpress-theme-functions-in-calendar-theme/#post-4867654)
 * Status: not resolved