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 have a regular wordpress site and I am trying to make a mobile version of the same site. For the blog section, I have put all of the posts in two categories: blog and mobile.

The posts in "blog" show up fine on the regular site. Now I want those same posts to show up on the mobile site, but they need to be styled different to fit in the mobile world.

My initial thought was just to put a post in both categories, but I've now realized that I can't just stylize the templates for both categories because since the posts are in two categories, wordpress (or single.php) doesn't know which category I want to have displayed.

Which leads me to my questions: 1. Is there a way to do what I have described above? It seems that single.php would have to know where the link was coming from in order to figure out which template to use.

  1. Is there a better way to do what I'm trying to do?

Basically, when a post is clicked on from the "category/blog" page, it should look one way and when it is clicked on from the "category/mobile" page, it should look different.

I have been searching for days and I've found some posts and forums that deal with this, but no one seems to have an answer. Some posts have mentioned that there is a way to capture the current page url and then force single.php to display a certain template based on the link it comes from, however no one actually describes how it is done.

The closest thing to what I'm trying to do seems to be discussed here but I don't understand what was done and I can't get it to work for me. I have posted in that forum, but no one has responded.

This post here also seems to be trying to do something similar, but I don't understand how it works.

The only way I can think to make this work is to have the author (who is not me) double post their post to two different categories, but that would become a pain.

I've tried my best to articulate what I'm trying to do. If I'm not being clear, please let me know and I'll try to clarify.

I'm hoping someone can help me either figure this out or show me a better way to do it.

Thanks in advance.

share|improve this question
2  
Is this something you could accomplish just through CSS? Do you want to serve different content to mobile or just have it in a different layout? –  zac Aug 6 '11 at 3:33
add comment

2 Answers

Is there a better way to do what I'm trying to do?

Yes, use a mobile plugin or use your RSS feed to style a mobile version.

share|improve this answer
add comment

just use a responsive theme and 1 category. Non mobile will get content shown for them. Mobile will get styles for them. Magic

share|improve this answer
add comment

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.