WordPress.org

Ready to get started?Download WordPress

Forums

adding an SQL post query into wp_query (2 posts)

  1. roryrothon
    Member
    Posted 2 years ago #

    I am developing a miltisite network Marketplace.

    I can pull posts from all of my children blogs via an sql query, but is there a way that i can add this into an already declared WP_Query(); ?

    I have posted some pastebins to make life that little easier lol.

    1) This is a function that queries posts ready for a "Portfolio" page template:
    http://pastebin.com/vX8B7QQr

    Notice the $portfolio_query = new WP_Query($portfolio);
    The page template loop starts (minus all the other stuff): $portfolio_query->have_posts

    2) I am using an sql query by pulling all PUBLISHED posts into an array. Im not an expert coder and i am still learning, & loving it so.

    Could someone be kind enough to show there own FULL example of a multisite sql post query? i assume i need to use setup_postdata() somewhere in there too?

    The general idea is to create the "Multisite" query, and somehow merge this query with the above declared $portfolio_query.

    Any help or advice would be great.
    Thank

    Rory

  2. Multisite is the same as Singlesite, there's just not one query to run to search all the posts. Each site has its posts in it's own table.

Topic Closed

This topic has been closed to new replies.

About this Topic