- alkkdlkx
9 分钟 7 秒之前 - tmhvrb
9 分钟 18 秒之前 - vvqfyciu
9 分钟 19 秒之前 - detqjlm
9 分钟 22 秒之前 - bjebss
9 分钟 26 秒之前 - nlkepn
9 分钟 31 秒之前 - cwuuwc
9 分钟 31 秒之前 - kntqia
9 分钟 31 秒之前 - 自动的功能还是少用~
1 小时 58 分钟之前 - 自动的功能还是少用~
1 小时 59 分钟之前
该函数从当前主题文件夹中包含sidebar.php模板文件。如果指定了名称,那么函数将包含一个特殊的侧边栏文件sidebar-special.php。如果主题中没有sidebar.php文件,那么函数会包含来自默认主题wp-content/themes/default/sidebar.php的侧边栏文件。
<?php get_sidebar( $name ); ?>
$name
(字符串)(可选)对sidebar-name.php的调用
默认值:None
简单的404页面
下面是一个为“HTTP 404: Not Found”错误(在主题文件中为404.php)而制作的简单模板。
<?php get_header(); ?>
<h2>Error 404 - Not Found</h2>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
左侧侧边栏和右侧侧边栏
一个主题中包含两个侧边栏
<?php get_header(); ?>
<?php get_sidebar('left'); ?>
<?php get_sidebar('right'); ?>
<?php get_footer(); ?>
多个侧边栏
不同页面上的不同侧边栏
<?php
if ( is_home() ) :
get_sidebar('home');
elseif ( is_404() ) :
get_sidebar('404');
else :
get_sidebar();
endif;
?>
get_sidebar()位于wp-includes/general-template.php中。
get_header, get_sidebar, get_search_form, comments_template, get_footer()
发表新评论