I am working on a multisite blog network where I have to display recent post on my home page, 10 post per page navigation.
I did implement it using wpdb object with one complex sql statement.
- I got blog ids us
- looped through each blog id list and generated a one single sql query to get post from all sites
wpdb->get_resultto get list of posts from all subsites
I have recently started working on PHP and WordPress and am still learning it.
Is use of
wpdb object is the right way in this situation? I have read in many articles which uses
WP_Query object. I don't know how to use
WP_Query object in this situation?
Help me implement this in right/better way.