我想我找到了答案。在页脚中。php文件在页脚之外添加一个这样的div,并将您的页脚类分配给它。例如
<div class="sticky-footer">
<footer id="colophon" class="site-footer">
<div class="site-info">
<?php
/* translators: 1: Theme name, 2: Theme author. */
printf( esc_html__( \'Theme: %1$s by %2$s.\', \'best\' ), \'best\', \'<a href="http://underscores.me/">Underscores.me</a>\' );
?>
</div><!-- .site-info -->
</footer><!-- #colophon -->
</div><!-- #page -->
</div>
正确的样式是:
.sticky-footer {
padding:2em;
bottom:0;
clear:both;
background-color:black;
color:white;
position:static;
width:100%;
}