WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: The Events Calendar] Pulling calendar events using "query_posts()" (1 post)

  1. mgreis
    Member
    Posted 4 years ago #

    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:

    &cat=&eventDisplay=upcoming

    I think that should read:

    &cat=nn&eventDisplay=upcoming

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic