WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Trying to use a custom query with WP_Query

[Resolved] Trying to use a custom query with WP_Query

  • jeremyduffy
    Member

    @jeremyduffy

    I’m trying to use the standard loop variables and functions (the_content, the_tags() etc), but I’m having trouble making it work.

    I have a custom query and tried using setup_postdata with the posts before calling the_content and such, but no dice. I tried finding a way to thrust my query into a WP_Query object to see if nature would take it’s course and everything would be fine, but no.

    WP_Query wants a query like this “author=1&cats=3,4” or something like that, but I wrote an actual SQL query (WP_Query isn’t cutting it).

    In the end, I have an array of post results that I want to use with normal wordpress stuff. I could just print out the title and content manually, but if I can use “the_content” etc, it would be easier for others to use this plugin I’m making.

Viewing 1 replies (of 1 total)
  • jeremyduffy
    Member

    @jeremyduffy

    Ok… I think I answered my own question almost immediately… I did use setup_postdata and then when I called the_post on the same post data, it seems to work now… Sheesh.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Trying to use a custom query with WP_Query’ is closed to new replies.