Support » Plugins » [Plugin: The Events Calendar] Pulling calendar events using “query_posts()”

  • I am far from an expert in using “the loop”, but I have managed to muddle through enough of the documentation and experiment with code enough so that I can pull posts from a WordPress blog for display on a web site. (I use a technique that calls blog-header.php to make all the WP stuff available to a web site php program, all of which works because the blog and the web site are on the same system).

    According to this documentation post, you can use query_posts() to pull upcoming calendar events using this syntax:


    I think that should read:


    where nn is the category number of the Events category in your WrodPress blog. That may be obvious to veterans in using “the loop” to get stuff from WordPress, but took me a couple of tries to realize, so may be of help to someone else.

    I’m not sure if there’s an easy way from the WP dashboard to determine the category number of a given category. I find mine with a simple SQL query of the WP database:

    select * from wp_terms

    The wp_terms table contains all the categories and tags for your blog. The term_id field is the category number.

  • The topic ‘[Plugin: The Events Calendar] Pulling calendar events using “query_posts()”’ is closed to new replies.