0

I got 2 separate installations of WordPress, one on the main site and other on the sub-domain. Is there a possibility of showing posts from sub-domain on the main site, along with the articles of the main site. Like, every alternate article displayed, be from the sub-domain irrespective of the date published.

I read this article, but wasn't able to achieve what I wanted: How to show recent post in the main domain from subdomain blog

Here are the functions.php, index.php and single.php files of the theme I'm using:

  1. Functions.php http://pastebin.com/s3tfdnB2
  2. Index.php http://pastebin.com/nxtMZzLq
  3. Single.php http://pastebin.com/sgpfvtVe

Any help would be highly appreciated. Thanks.

Community
  • 1
  • 1

1 Answers1

0

How about access the database of the subdomain in your main domain and query the recent posts there.

$mydb = new wpdb('username','password','database','localhost');
$rows = $mydb->get_results("select recent posts");
echo "<ul>";
   foreach ($rows as $obj) :
      //display data here
   endforeach;
echo "</ul>";

see more

NOTE: This isn't a perfect solution if you've enabled Wordpress network for your subdomain.

Community
  • 1
  • 1
loQ
  • 2,147
  • 18
  • 21