• All, I’m trying to basically find where the SQL statement to display posts are. I’ve added some add_meta_box code to my functions.php for a post. I then saved these values into a custom table that I created.

    I’ve included things as a address, zip code, website etc. I’d like to be able to do a select on the zip code and also certain categories that I’ve defined in my posts but be able to display the address and website etc. How could I go about writing something to select certain posts from my custom table? I’m not even sure what file WordPress actually has the SQL statement to do this…

    I know how to actually display the selected fields but just want to make sure I have the ability to select them all from my custom table.

    Thanks for any help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • I probaaby don’t quite follow you, but I must ask, do you know if this is something which couldn’t be done with the standard wp custom fields and some kind of query to output the values you want?

    Thread Starter treeleaf20

    (@treeleaf20)

    I’m not entirely sure. Is there an example on how to use the custom fields in a query? I don’t think that you can do a join on two tables using the custom query. I want to use something like:

    Select custom.address1, custom.zip, wp_post.title
    From wp_posts
    Join wp_posts.post_id=custom.post_id
    Where custom.zip=’$zip’

    Then display output based on this query.

    This thread discusses getting mutiple meta values with a singe query:
    query_posts-where-custom-field-is-true
    But I have a sence you are trying to do a bit more than this.Unfortunately I’m not famiiar with the “tables” terminalogy you speak of, sound’s like date base lingo, of which I’m not at all familiar. I’m just a theme guy.

    Thread Starter treeleaf20

    (@treeleaf20)

    Yes, you’re correct. I’ll need more then this. Do you know which file WordPress uses to actually build the posts search query?

    nope, I always thought I did that when ever I type in “query_posts”, so what you’re talking about a bit deep for me, sorry:(

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Change the Select statement to display posts in WordPress’ is closed to new replies.