gcox
By: a guest | Jan 28th, 2010 | Syntax:
PHP | Size: 0.79 KB | Hits: 46 | Expires: Never
/*
I'm trying to add a function to my theme's functions.php that queries a table created by Kieran O'Shea's calendar module. Though I do have entries in the "wp_calendar" table, the queries don't display any results.
The $myTest section was added just to test if anything could be queried at all. This also returns nothing.
*/
function upcomingEvents() {
global $wpdb;
$myTest = $wpdb->get_results("select count(*) as count from $wpdb->calendar");
echo "<h2 id=\"mytest\">count=" . $myTest->count . "</h2>";
$myList = $wpdb->get_results("SELECT * FROM $wpdb->calendar ORDER BY event_begin DESC");
foreach ($myList as $myItem) {
echo "begin:" . $myItem->event_begin . "--title:" . $myItem->event_title;
}
//Corresponding shortcode
add_shortcode('upcoming','upcomingEvents');
}