WordPress.org

Ready to get started?Download WordPress

Forums

Create a new query and pass it on the fly (1 post)

  1. Tilex
    Member
    Posted 3 years ago #

    I'd like to know if it's possible to create a new query "on the fly" and pass it to a new page template.

    For example, I've a template called "single.php", which is for every "Restaurant" page.

    If a user clicks on Category->Sea Food (catid=5), a query query_posts(cat=5)
    is sent to the header as a global variable, so fine so far.

    However, once I'm into Category Sea Food, I want to sort the restaurants in any order -> latest, best rated, etc ...

    Can I send a custom query to my template single.php when a user clicks on a link like Category->Sea Food -> Best Rated where "Best Rated" query would be a custom built SQL query ?

    Thanks ! Alex

    But,

Topic Closed

This topic has been closed to new replies.

About this Topic