如何让我的整个页脚显示在所有页面模板上?它目前只出现在主页上。使用wordpress

时间:2016-09-21 19:01:03

标签: php wordpress templates footer

我使用的是使用Cherry Framework制作的Wordpress模板。完整的页脚仅出现在主页上。我希望它出现在所有页面类型上,这些类型主要是'全宽页面模板'。

当我查看每个模板的PHP文件时,我能看到的区别是:

<?php do_action( 'cherry_after_home_page_content' ); ?>

我似乎无法找到定义cherry_after_home_page_content的位置。这可能是我正在寻找的吗?我尝试将其复制到全宽页面模板中,但它不起作用。如果我完全偏离基础,那么实现这个目标的正确方法是什么?

每个页面上显示的页脚,与模板类型无关。这是截图:

Footer that appears on every page regardless of template type

来自全宽页面模板的代码:

<?php
/**
* Template Name: Fullwidth Page
*/

get_header(); ?>

<div class="motopress-wrapper content-holder clearfix">
    <div class="container">
        <div class="row">
            <div class="<?php echo cherry_get_layout_class( 'full_width_content' ); ?>" data-motopress-wrapper-file="page-fullwidth.php" data-motopress-wrapper-type="content">
                <div class="row">
                    <div class="<?php echo cherry_get_layout_class( 'full_width_content' ); ?>" data-motopress-type="static" data-motopress-static-file="static/static-title.php">
                        <?php get_template_part("static/static-title"); ?>
                    </div>
                </div>
                <div id="content" class="row">
                    <div class="<?php echo cherry_get_layout_class( 'full_width_content' ); ?>" data-motopress-type="loop" data-motopress-loop-file="loop/loop-page.php">
                        <?php get_template_part("loop/loop-page"); ?>
                    </div>
                </div>
            </div>
            <?php do_action( 'cherry_after_home_page_content' ); ?>
        </div>
    </div>
</div>

<?php get_footer(); ?>

仅在主页上显示的完整页脚。以下是截图:

Complete footer that only appears on the home page

主页模板中的代码:

<?php
/**
* Template Name: Home Page
*/

get_header(); ?>

<div class="motopress-wrapper content-holder clearfix">
    <div class="container">
        <div class="row">
            <?php do_action( 'cherry_before_home_page_content' ); ?>
            <div class="<?php echo apply_filters( 'cherry_home_layout', 'span12' ); ?>" data-motopress-wrapper-file="page-home.php" data-motopress-wrapper-type="content">
                <div class="row">
                    <div class="<?php echo apply_filters( 'cherry_home_layout', 'span12' ); ?>" data-motopress-type="static" data-motopress-static-file="static/static-slider.php">
                        <?php get_template_part("static/static-slider"); ?>
                    </div>
                </div>
                <div class="row">
                    <div class="<?php echo apply_filters( 'cherry_home_layout', 'span12' ); ?>" data-motopress-type="loop" data-motopress-loop-file="loop/loop-page.php">
                        <?php get_template_part("loop/loop-page"); ?>
                    </div>
                </div>
            </div>
            <?php do_action( 'cherry_after_home_page_content' ); ?>
        </div>
    </div>
</div>

<?php get_footer(); ?>

1 个答案:

答案 0 :(得分:0)

我想到了这一点,所以对于遇到同样问题的人来说也是如此。

&#34; cherry_after_home_page_content&#34;与此毫无关系。 (实际上我之后注意到,在上面的粘贴代码中,我不小心将代码粘贴到了不属于它的全宽页面模板中。哎呀!)

无论如何,它只是在CSS中。如果您看到页脚小部件仅出现在您的主页上,您可能在CSS中有这个:

.home .footer .footer-widgets { display:block; }

在您的子主题中,粘贴上面的代码,但将.home更改为您希望它显示的页面。对我而言,所有常规页面的.page,博客的.blog和.single-post。

希望能帮助别人!