WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Trying to use a custom query with WP_Query (2 posts)

  1. jeremyduffy
    Member
    Posted 3 years ago #

    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.

  2. jeremyduffy
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic