wordpress底部标签get_footer
get_footer是用来调用主题中的底部文件模板footer.php,如果在模板文件中未创建footer.php文件,标签会调用程序路径wp-includes/theme-compat/footer.php中的内置文件,在模板制作中我们通过以下标签进行底部文件的调用:
<?php get_footer( $name ); ?>
其中$name参数可以支持不同页面调用不同的底部模板文件,例如:
在模板中设置 footer-home.php 首页底部文件,我们可以通过以下代码调用这个特殊的底部模板文件:
<?php get_footer( 'home' ); ?>
通过判断语句在不同页面调用不同的底部模板文件:
<?php if ( is_home() ) : //是否是首页 get_footer( 'home' ); //调用首页模板文件 footer-home.php elseif ( is_404() ) : //是否是404页面 get_footer( '404' ); //调用404底部模板文件 footer-404.php else : get_footer(); //调用footer.php文件 endif ; ?>查看更多关于wordpress底部标签get_footer - WordPress的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did8990