【发布时间】:2020-09-10 01:41:10
【问题描述】:
这个固定的侧边栏信息永久位于我的页脚下方。我在 Wordpress 中创建了一个子主题,但还没有触及任何文件。我确实从 Envato 元素中添加了一个页脚,然后单击了侧边栏小部件,但现在没有保存任何侧边栏小部件,所以我不确定为什么这个文本会永久粘在我的页脚上。
<?php
/**
* The template for displaying the footer.
*
* @package OceanWP WordPress theme
*/ ?>
</main><!-- #main -->
<?php do_action( 'ocean_after_main' ); ?>
<?php do_action( 'ocean_before_footer' ); ?>
<?php
// Elementor `footer` location
if ( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'footer' ) ) { ?>
<?php do_action( 'ocean_footer' ); ?>
<?php } ?>
<?php do_action( 'ocean_after_footer' ); ?>
</div><!-- #wrap -->
<?php do_action( 'ocean_after_wrap' ); ?>
</div><!-- #outer-wrap -->
<?php do_action( 'ocean_after_outer_wrap' ); ?>
<?php
// If is not sticky footer
if ( ! class_exists( 'Ocean_Sticky_Footer' ) ) {
get_template_part( 'partials/scroll-top' );
} ?>
<?php
// Search overlay style
if ( 'overlay' == oceanwp_menu_search_style() ) {
get_template_part( 'partials/header/search-overlay' );
} ?>
<?php
// If sidebar mobile menu style
if ( 'sidebar' == oceanwp_mobile_menu_style() ) {
// Mobile panel close button
if ( get_theme_mod( 'ocean_mobile_menu_close_btn', true ) ) {
get_template_part( 'partials/mobile/mobile-sidr-close' );
} ?>
<?php
// Mobile Menu (if defined)
get_template_part( 'partials/mobile/mobile-nav' ); ?>
<?php
// Mobile search form
if ( get_theme_mod( 'ocean_mobile_menu_search', true ) ) {
get_template_part( 'partials/mobile/mobile-search' );
}
} ?>
<?php
// If full screen mobile menu style
if ( 'fullscreen' == oceanwp_mobile_menu_style() ) {
get_template_part( 'partials/mobile/mobile-fullscreen' );
} ?>
<?php wp_footer(); ?>
</body>
</html>
【问题讨论】:
-
footer.php 中的代码是什么?这是一个可以看看的王牌,你的页脚中插入了什么。
-
我在原始帖子中添加了footer.php!提前感谢您的帮助
-
看起来您正在页脚内显示一个侧边栏。您的代码中有一个 if 条件检查
if ('sidebar ...'。尝试删除整个 if 子句(但保留一份副本),有帮助吗?如果没有,我不知道这些操作在做什么......也许您在页脚中放置了一个侧边栏元素,放置在可视化构建器中。你知道<?php do_action( 'ocean_footer' ); ?>和ocean_footer 是什么吗?
标签: php wordpress footer sidebar