Recent Posts
HTML | 4 sec ago
None | 30 sec ago
None | 32 sec ago
Make | 37 sec ago
None | 52 sec ago
None | 1 min ago
None | 2 min ago
None | 2 min ago
None | 2 min ago
C | 2 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
By gcox on the 28th of Jan 2010 02:42:35 PM
Download |
Raw |
Embed |
Report
/*
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');
}
Submit a correction or amendment below.
[ previous version ] | [ difference ] | Make A New Post