Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I creating shopping cart, based on custom post types. And for this cart I have two related custom taxonomies.

  • I need to create shop.mysite.com instead of mysyte.com/shop only for this one custom post type.
  • I dont need multisite solution.
  • All posts of current post types will be opened as shop.mysite.com/some-post/.
  • Related custom taxonomies will be opened as shop.mysite.com/customtax/some-tax-value/.
  • Additionally also would like to redirect a few pages related to shop as shop.mysite.com/some-static-page/

Thank You for help!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

While multisite would give you exactly what you wanted via domain mapping, you've opted to throw away this option in favour of the much more time consuming and harder method of manual htaccess rewrites etc.

The challenges you face include:

  1. Telling wordpress to rewrite the permalink URLs it outputs to shop.mysite.com but not for the whole site
  2. Redirecting users who arrive at mysite.com/shop/some-post
  3. handling the wordpress permalink infrastructure

How you would make it work without multisite:

  1. You would have to write out all your own permalinks, or add a hook so that get_permalink/the_permalink and the menus, etc all use the right domain
  2. You would need to setup a htaccess at shop.mysite.com so that it mapped on to the normal page. You would then need to check for the referrer at the normal page to redirect to the subdomain if its found.
  3. You would need to add the shop prefix in the rewrite when you register your custom post type
  4. When handling the subdomain, you will need to account for the /shop prefix else you will have shop.mysite/shop/some-post

OR

You could set up a second wordpress install on the shop subdomain with the same tables etc. This would be easier than the above, but would introduce certain other issues, and you would need two themes, hardcoded to filter out the content from the other counterpart.

How you would make it work with multisite:

  1. You would create a second site for the shop subdomain
  2. HTAccess rules would be added to forward any request to mysite.com/shop on to shop.mysite.com
  3. When you want to display shop items on the mainmysite.com domain, you would do the following:

http://codex.wordpress.org/Function_Reference/switch_to_blog

switch_to_blog($shopsiteID);
// display shop items
restore_current_blog();

As you can see doing it without multisite is considerably more work than doing it with multisite, since a lot of the work you would need to do has already been done to implement multisite.

I would recommend you attempt them in the following order:

  • multisite easy
  • Two installs hard ( cookie/upload hell )
  • One install hardest ( permalink hell )

The only solution that will get you what you want without massive kludges is the multisite option coupled with domain mapping. I estimate not using multisite will triple the number of hours and cost of this task with no guarantee of a satisfactory result at the end.

So yes, you do not need multisite, just like I don't need tires on my car, it is doable, but why make things hard for yourself. Multisite is going to be suggested a lot to you, because it is the easiest, simplest, fastest and safest means of doing it.

share|improve this answer
    
Thank you for help.. My problem - one design theme for all site. And i need to hard rewriting all design sections of the site with switch_to_blog() function for importing data to both directions ( site <===> shop ) ... And my shop using the same taxonomies and custom post types as the main site in admin section.. –  Bohdan Hdal Nov 18 '11 at 19:12
    
well you don't need all the content to be duplicated twice, just link between the two sites, and you don't need two duplicate the themes, just make the shop use a child theme if it needs to be different. –  Tom J Nowell Nov 19 '11 at 0:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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