Choosing between various stylesheets

Questions and tutorials related to Cascading Style Sheets *all versions*

Moderators: macek, egami, gesf

peoplayer
New php-forum User
New php-forum User
Posts: 1
Joined: Tue Aug 28, 2012 3:35 pm

Choosing between various stylesheets

Postby peoplayer » Tue Aug 28, 2012 3:44 pm

Hi guys. This might be an easy question (hopefully) for you to answer. I know very little about PHP programming, so here goes:

I have a wordpress blog that uses three different stylesheets depending on the platform where the blog is viewed (web, ipad, iphone).

I recently made a tab on my Facebook page which opens the blog in an iframe, but it opens the web stylesheet which is way too wide for the max width in Facebook tabs (810 px). However, the ipad stylesheet would work just fine there. I still wish to see the normal web view when I enter my web from outside Facebook, so it isn't an option to swith to the ipad-stylesheet as a default stylesheet.

Is there a way of passing on a parameter from the facebook tab: e.g. http://www.myblog.com/?style=facebook so that the site that shows inside the facebook tab uses the right stylesheet? I would think more people have had this problem but I have scoured the Internet for hours without knowing really what to look for.

This is the code in the header.php that deals with the stylesheets:

Code: Select all

<!-- Theme Styles -->
   <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/style.css" type="text/css" media="screen" />
   <?php $disable_theme_features = of_get_option( 'disable_theme_features' ); if ($disable_theme_features['4'] == '0') { ?>
   <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/style-ipad.css" type="text/css" media="screen" />
   <?php } if ($disable_theme_features['3'] == '0') { ?>
   <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/style-iphone.css" type="text/css" media="screen" />
   <?php } ?>


Is there a way to make this happening without resorting to a complete makeover of the template? Any help would be greatly appreciated!! And sorry again if this is a noob question, that is because i am noob at PHP.

Thanks again!

Return to “CSS”

Who is online

Users browsing this forum: No registered users and 1 guest