May be this is not a good question, but I couldn't find a proper solution for my issue yet. So I'm planing to post that over here.

Question in Brief

I have to implement a separate url for each blog post with a different look but with same content as it is in the original blog post.

More Details

We are planing to build new mobile app for our blog. So in the app we are planing to load the blog post via web url. But we can't use the original url as it has many unnecessary things(widget,extra links) when we think about the load & the design perspectives. So we plan to have different url for each post which has a different theme but with same content as it is in original post.

However for normal blog uses who use the blog with mobile devices, still get the original blog view(we are using responsive design). That means We doesn't need to use different theme for mobile uses specially.

Why no API

Also we didn't go with the API & rebuild the things within the mobile app due to following reasons,

  1. we should have a same design as it is in the web
  2. reproducing that in the app take a while & can't achieve 100%
  3. we can reuse it for android & windows in future
  4. design changes can easily implemented


Suppose I have a post on my blog with the url www.example.com/sample_post, this will work in anywhere including mobile devices.

But we need separate url like m.example.com/sample_post with the same post content as it is in the main url but with different theme which has only the post content(no extra widgets & all). This url we could only be using within the mobile app and we plan to use SEO unfollow meta tags. So there won't be any downfalls for SEO side as content reproduce.

I have edited the question with more details which makes easy to understand with the help of comment & answers so far. I hope you will get clear idea the question now.

  • Not sure what could be benefit of using custom URLs for mobile devices but maybe you should try wp_is_mobile() and home_url hook.
    – dan9vu
    Aug 3, 2016 at 14:27
  • Do you really need a extra mobile version or do you just need the information for your mobile app? Aug 3, 2016 at 15:11
  • 1
    @ialocin no, I didn't need a extra mobile version as it is a responsive design. but we are planing to develop a mobile app, inside the app we are planing to load the same content as it is in the blog. if we load the real url, then it will contain a lot of unnecessary things in terms of the load and view perspective. So that we plan same blog post with different theme as a solution. Hope you understand the situation Aug 4, 2016 at 5:22
  • @Dan9 site is working fine in the mobile, so that I didn't need to change anything over there. but I need different url for each post which should load with different theme. Aug 4, 2016 at 5:55
  • @JanithChinthana Maybe a theme switching plugin can help. Such as this plugin. Or you can learn from source code of those plugins to create your own one. Take a look at stylesheet filter and switch_theme() function too.
    – dan9vu
    Aug 4, 2016 at 6:14

2 Answers 2


As of clarification via comment, you really don't need a additional version, subdomain with the same content. What you need is to get the post content, nothing more. The styling and such should happen in your app, not by pulling it from the site. At least that's how I feel about it.

Anyhow, for this you can use WP REST API. It is partly integrated into core and will be integrated completely, for now you can extend on the already implemented functionality by using the plugin version of the API. Below I link you some resources. There is a stable, but deprecated, version 1.2.5 and a version 2.0-beta13.1 of the plugin. Personally I would definitely go with the version 2 beta, because it is well on its way. But you have to read up on it yourself, so you can make a educated decision on your own.


Ok, another suggestion, but as said in the comment, I am not convinced it is the best approach.

You could duplicate the content in a similar way as MultilingualPress does it. It works with single sites of a multisite setup. Although it is a translation plugin, there isn't actually a need to translate. Besides this just a proposal, which you can use for orientation.

  • that was our first choice, however due to few reasons we decided to go with the mobile url as follows. 1. we should have a same design as it is in the web 2. reproducing that in the app take a while & can't achieve 100% 3. we can reuse it for android & windows in future 4. design changes can easily implemented Aug 4, 2016 at 9:02
  • @JanithChinthana I'm still not getting, why you need a extra domain, if, as you told me, your users get the mobile view via your main domain and responsive design. I kind of get your points, but I am not necessarily convinced it's the best approach. Anyhow, I'll add another suggestion to my answer. Aug 4, 2016 at 9:33
  • in the mobile app, I don't need show everything(extra widgets), just need to show the post content. That is why we come to the conclusion that we need separate mobile url only to deal with mobie app. but for normal mobile uses, they still get the full view of the site with widgets & all. Aug 4, 2016 at 9:40
  • I will have a look for above plugins, thanks for the suggestion Aug 4, 2016 at 9:43
  • My pleasure, good luck! @JanithChinthana Aug 4, 2016 at 9:44

Method 1: wp-config.php

Wordpress stores data such as the primary uri and the active theme in the database but you can get around this by editting the wp-config.php of the second install. This requires that both installations have access to the same database.

$table_prefix1 = 'wp1_';
$table_prefix2 = 'wp2_'; 

$wpdb->posts = $table_prefix1 . 'posts';
$wpdb->users = $table_prefix1 . 'users';
$wpdb->categories = $table_prefix1 . 'categories';
$wpdb->post2cat = $table_prefix1 . 'post2cat';
$wpdb->comments = $table_prefix1 . 'comments';
$wpdb->links = $table_prefix1 . 'links';
$wpdb->linkcategories = $table_prefix1 . 'linkcategories';
$wpdb->options = $table_prefix2 . 'options'; // <-- Note this one uses the other prefix
$wpdb->postmeta = $table_prefix1 . 'postmeta';
$wpdb->usermeta = $table_prefix1 . 'usermeta';

$wpdb->prefix = $table_prefix;

Method 2: RSS feed reading plugins

If the two installs are on different servers and for some reason you can't access the same database remotely, then a workaround is have to get the second wordpress site to imports the posts from the first via an RSS feed plugin, such as FeedWordPress.

Search engine considerations

Which ever method you use, you should ensure that the second site is configured NOT to index in search engines, else both sites will suffer in search rankings. If that matters to you.

  • It certainly can be done, with the WP REST API as @ialocin suggests. Aug 10, 2016 at 9:33
  • @TobiasBeuving Okay, have edited answer to remove erroneous claim, and have emphasised parts that actually answer the question. Aug 10, 2016 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.