0

首先,我首先要说的是,我无论如何都不精通 PHP。

我希望我的页脚显示在所有页面(wordpress 网站)上,现在不是问题。我想要的,是为了

<div class="inner-footer-wrapper">

隐藏在主页上。

这是我在 footer.php 中的内容

    <div id="footer">
    <div class="inner-footer-wrapper">

    <?php if (!is_page_template("template-maintenance-page.php") && $super_options[SN."_footer_widgets"]=="Yes") : ?>
    <div class="container clearfix">  

    <?php 
    $footer_layout = $super_options[SN."_footer_layout"];
    switch($footer_layout)
    {
    case "two-col" : 

    echo '<div class="footer-cols one_half clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols one_half_last clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>"; 

    break;
    case "three-col" : 

    echo '<div class="footer-cols one_third clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols one_third clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>";

    echo '<div class="footer-cols one_third_last clearfix">';
    dynamic_sidebar ("Footer Column 3"); 
    echo "</div>"; 

    break;
    case "four-col" : 

    echo '<div class="footer-cols one_fourth clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols one_fourth clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>";

    echo '<div class="footer-cols one_fourth clearfix">';
    dynamic_sidebar ("Footer Column 3"); 
    echo "</div>";

    echo '<div class="footer-cols one_fourth_last clearfix">';
    dynamic_sidebar ("Footer Column 4"); 
    echo "</div>"; 

    break;
    case "five-col" : 

    echo '<div class="footer-cols one_fifth clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols one_fifth clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>";

    echo '<div class="footer-cols one_fifth clearfix">';
    dynamic_sidebar ("Footer Column 3"); 
    echo "</div>";

    echo '<div class="footer-cols one_fifth clearfix">';
    dynamic_sidebar ("Footer Column 4"); 
    echo "</div>";

    echo '<div class="footer-cols one_fifth_last clearfix">';
    dynamic_sidebar ("Footer Column 5"); 
    echo "</div>"; 

    break;
    case "six-col" : 

    echo '<div class="footer-cols one_sixth clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols one_sixth clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>";

    echo '<div class="footer-cols one_sixth clearfix">';
    dynamic_sidebar ("Footer Column 3"); 
    echo "</div>";

    echo '<div class="footer-cols one_sixth clearfix">';
    dynamic_sidebar ("Footer Column 4"); 
    echo "</div>";

    echo '<div class="footer-cols one_sixth clearfix">';
    dynamic_sidebar ("Footer Column 5"); 
    echo "</div>";

    echo '<div class="footer-cols one_sixth_last clearfix">';
    dynamic_sidebar ("Footer Column 6"); 
    echo "</div>"; 

    break;

    case "one-third" : 

    echo '<div class="footer-cols one_third clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols two_third_last clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>"; 

    break;
    case "one-fourth" : 

    echo '<div class="footer-cols one_fourth clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols three_fourth_last clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>"; 

    break;
    case "one-fifth" : 

    echo '<div class="footer-cols one_fifth clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols four_fifth_last clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>"; 

    break;
    case "one-sixth" : 

    echo '<div class="footer-cols one_sixth clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols five_sixth_last clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>"; 

    break;


    }
    ?>

    </div>
    <?php endif; ?>
    </div>
    <div id="footer-menu">
    <div class="container clearfix">

    <p class="footer-text"><?php echo $helper->customFormat($super_options[SN."_footer_text"]); ?></p> 

    <?php  if(!is_page_template("template-maintenance-page.php") && $super_options[SN."_footer_menu"]=="Yes") : 
    if(function_exists("wp_nav_menu"))
    {
    wp_nav_menu(array(
    'theme_location'=>'footer_nav',
    'container'=>'ul',
    'depth' => 1
    )
    );
    }
    endif;
    ?>

    </div>      
    </div>
    </div>


    <script type="text/javascript">
    <?php 
    echo stripslashes($super_options[SN."_tracking_code"]);
    ?>
    </script>
    <?php  wp_footer();  ?>
    </body>
    </html>

我试图做一个 if is_home 语句,但我没有足够的知识知道它的去向。有什么帮助吗?谢谢!

4

2 回答 2

1

将您不想在主页上显示的所有内容包装起来

<?php if(!is_home()){?>

             //code here

<?php } ?>

或者:

<div id="footer">
    <?php if(!is_home()){?>
    <div class="inner-footer-wrapper">

    <?php if (!is_page_template("template-maintenance-page.php") && $super_options[SN."_footer_widgets"]=="Yes") : ?>
    <div class="container clearfix">  

    <?php 
    $footer_layout = $super_options[SN."_footer_layout"];
    switch($footer_layout)
    {
    case "two-col" : 

    echo '<div class="footer-cols one_half clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols one_half_last clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>"; 

    break;
    case "three-col" : 

    echo '<div class="footer-cols one_third clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols one_third clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>";

    echo '<div class="footer-cols one_third_last clearfix">';
    dynamic_sidebar ("Footer Column 3"); 
    echo "</div>"; 

    break;
    case "four-col" : 

    echo '<div class="footer-cols one_fourth clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols one_fourth clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>";

    echo '<div class="footer-cols one_fourth clearfix">';
    dynamic_sidebar ("Footer Column 3"); 
    echo "</div>";

    echo '<div class="footer-cols one_fourth_last clearfix">';
    dynamic_sidebar ("Footer Column 4"); 
    echo "</div>"; 

    break;
    case "five-col" : 

    echo '<div class="footer-cols one_fifth clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols one_fifth clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>";

    echo '<div class="footer-cols one_fifth clearfix">';
    dynamic_sidebar ("Footer Column 3"); 
    echo "</div>";

    echo '<div class="footer-cols one_fifth clearfix">';
    dynamic_sidebar ("Footer Column 4"); 
    echo "</div>";

    echo '<div class="footer-cols one_fifth_last clearfix">';
    dynamic_sidebar ("Footer Column 5"); 
    echo "</div>"; 

    break;
    case "six-col" : 

    echo '<div class="footer-cols one_sixth clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols one_sixth clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>";

    echo '<div class="footer-cols one_sixth clearfix">';
    dynamic_sidebar ("Footer Column 3"); 
    echo "</div>";

    echo '<div class="footer-cols one_sixth clearfix">';
    dynamic_sidebar ("Footer Column 4"); 
    echo "</div>";

    echo '<div class="footer-cols one_sixth clearfix">';
    dynamic_sidebar ("Footer Column 5"); 
    echo "</div>";

    echo '<div class="footer-cols one_sixth_last clearfix">';
    dynamic_sidebar ("Footer Column 6"); 
    echo "</div>"; 

    break;

    case "one-third" : 

    echo '<div class="footer-cols one_third clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols two_third_last clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>"; 

    break;
    case "one-fourth" : 

    echo '<div class="footer-cols one_fourth clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols three_fourth_last clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>"; 

    break;
    case "one-fifth" : 

    echo '<div class="footer-cols one_fifth clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols four_fifth_last clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>"; 

    break;
    case "one-sixth" : 

    echo '<div class="footer-cols one_sixth clearfix">';
    dynamic_sidebar ("Footer Column 1"); 
    echo "</div>";

    echo '<div class="footer-cols five_sixth_last clearfix">';
    dynamic_sidebar ("Footer Column 2"); 
    echo "</div>"; 

    break;


    }
    ?>

    </div>
    <?php endif; ?>
    </div>
<?php } ?>
    <div id="footer-menu">
    <div class="container clearfix">

    <p class="footer-text"><?php echo $helper->customFormat($super_options[SN."_footer_text"]); ?></p> 

    <?php  if(!is_page_template("template-maintenance-page.php") && $super_options[SN."_footer_menu"]=="Yes") : 
    if(function_exists("wp_nav_menu"))
    {
    wp_nav_menu(array(
    'theme_location'=>'footer_nav',
    'container'=>'ul',
    'depth' => 1
    )
    );
    }
    endif;
    ?>
    </div>      
    </div>
    </div>
    <script type="text/javascript">
    <?php 
    echo stripslashes($super_options[SN."_tracking_code"]);
    ?>
    </script>
    <?php  wp_footer();  ?>
    </body>
    </html>
于 2013-03-30T23:41:53.537 回答
1

在您的主页上,将其放在正文标记中-

<body <?php $page = "home"; ?>>

现在把它放在你的页脚标签中 -

<div class="inner-footer-wrapper" style="display:"<?php if($page == "home"){ echo "none";}?>">
于 2013-03-30T23:52:30.107 回答