Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress:两页的特殊css_Php_Css_Wordpress - Fatal编程技术网

Php Wordpress:两页的特殊css

Php Wordpress:两页的特殊css,php,css,wordpress,Php,Css,Wordpress,在我的博客中,我有两个网站,它们需要一个特殊的css。对于站点项目,我这样做: <?php if ( is_page('projects') ) { ?> <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/projects.css" type="text/css" media="screen" /> <?php } else { ?>

在我的博客中,我有两个网站,它们需要一个特殊的css。对于站点项目,我这样做:

 <?php if ( is_page('projects') ) { ?>
     <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/projects.css" type="text/css" media="screen" />
<?php } else { ?>
     <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<?php } ?>
这很有魅力。。但我也需要一个家庭的特殊css。。 我该怎么做。。?如果我只是说:

<?php if( is_home() ) { ?>
     <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/home.css" type="text/css" media="screen" />
<?php } ?>
在其他代码之上,它将不起作用

我现在使用的全部代码是:

<?php if( is_home() ) { ?>
     <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/home.css" type="text/css" media="screen" />
<?php } ?>


        <?php if ( is_page('projects') ) { ?>
         <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/projects.css" type="text/css" media="screen" />
    <?php } else { ?>
         <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <?php } ?>
谢谢你的帮助,对不起我的英语

你应该做:

<?php if(is_front_page()) { ?>
       // html code here
      <?php } else if ( is_page('projects')) { ?>
        // html code here 
      <?php } else { ?>
        // html code here
  <?php } ?>

谢谢你。。但我在使用时得到一张空白页:你应该注意关闭和打开谢谢你,伙计!完美的你欠我一个人情嘿,j/k