Support » Networking WordPress » adding an SQL post query into wp_query

  • roryrothon

    (@roryrothon)


    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

Viewing 1 replies (of 1 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Lead Plugin Wrangler

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘adding an SQL post query into wp_query’ is closed to new replies.