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...
Learn a little bit about the new Pastebin.com on our help page. hide message
By gcox on the 28th of Jan 2010 02:42:35 PM Download | Raw | Embed | Report
  1. /*
  2. 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.
  3.  
  4. The $myTest section was added just to test if anything could be queried at all. This also returns nothing.
  5. */
  6.  
  7. function upcomingEvents() {
  8.   global $wpdb;
  9.   $myTest = $wpdb->get_results("select count(*) as count from $wpdb->calendar");
  10.   echo "<h2 id=\"mytest\">count=" . $myTest->count . "</h2>";
  11.  
  12.   $myList = $wpdb->get_results("SELECT * FROM $wpdb->calendar ORDER BY event_begin DESC");
  13.   foreach ($myList as $myItem) {
  14.         echo "begin:" . $myItem->event_begin . "--title:" . $myItem->event_title;
  15.   }
  16.  
  17. //Corresponding shortcode
  18. add_shortcode('upcoming','upcomingEvents');
  19. }
Submit a correction or amendment below. [ previous version ] | [ difference ] | Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: