Hallo Frank,
ich denke das liegt daran dass style.css geladen wird und eben nicht mobilestyle.css. Alls div´s sind im container #page, ausgenommen #footer-bar. div #page ist ist overflow: hidden, also dürfte doch alles richtig sein?
Sag bitte Bescheid, wenn ich irgendwo irre…
Nun habe ich versucht die header.php im child-theme zu erweitern, dass wenigstens eine Funktion greift:
<?php
function theme_styles()
{
wp_register_style( ‚mobile-style‘, get_template_directory_uri() . ‚/mm-child/mobilestyle.css‘,array(),“,’all‘);
wp_enqueue_style(‚mobile-style‘);
}
function costum_style()
{
wp_register_style( ‚costum-style‘, get_template_directory_uri() . ‚/mm-child/style.css‘,array(),“,’all‘);
wp_enqueue_style(‚costum-style‘);
}
function mobil_styles_method()
{
wp_enqueue_style(‚custom-style‘, get_template_dirrectory_uri() . ‚/mm-child/style.css‘);
$mobilestyle = „
#page {
width: 480px;
display: inline;
float: left;
margin-left: 1%;
margin-right: 0;
position: relative;
}
#sidebar {
display: no;
}
#footer-bar {
width: 480px;
background-color: yellow;
}“;
wp_add_inline_style( ‚costum-style‘, $mobilestyle_css );
}
add_action(‚wp_enqueue_scripts‘,’mobil_styles_method‘); #LINE 41
function isMobile()
{
return preg_match(„/(android|avantgo|blackberry|mini|mobi|palm|phone|pie|tablet|webos|wos)/i“, $_SERVER[„HTTP_USER_AGENT“]);
}
if(isMobile())
{
add_action(‚wp_enqueue_scripts‘,’theme_styles‘);
}
?>
Ergebnis: Nichts, die header.php im child-theme wird wohl nicht berücksichtigt, denn wenn ich im Browser den Pfad dorthin angebe, heißt es:
Fatal error: Call to undefined function add_action() in /www/htdocs/w00cefc0/wp-content/themes/mm-child/functions.php on line 41:
(Zeile 41 habe ich oben kenntlich gemacht) Natürlich habe ich auch in der header.php einen Link zum mobil-stylesheet:
<link rel=“Stylesheet“ type=“text/css“ media=“handheld, screen and (max-width: 480px)“ href=“<?php echo get_stylesheet_directory_uri(); ?>/mobile.css“ />
Nichts von alledem scheint etwas zu bewirken?! Was ist das los?! Erkennt wp die stylesheets nicht oder stimmt die Pfadangabe nicht…?
Links:
http://codex.wordpress.org/Function_Reference/add_action
http://codex.wordpress.org/Function_Reference/wp_enqueue_style
http://codex.wordpress.org/Function_Reference/wp_add_inline_style
http://forum.wpde.org/mobil-mit-wordpress/111120-mobiles-css-einbinden.html
Gruß