如何制作wordpress侧边栏 [英] How to make wordpress sidebar
问题描述
你好,在我的网站上,我有一个由 wordpress 驱动的博客,我能够制作一个与网站相同的简单主题,但是我无法创建侧栏,有谁知道如何做到这一点,代码如下来自侧边栏文件
Hello on my website I have a Blog that is powered by wordpress, i was able to make a simple theme that is the same as the website however i cannot create a side bar, does anyone know how to do it heres the code from the sidebar file
<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<div id="secondary" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div><!-- #secondary -->
<?php endif; ?>
我没有函数文件,我只有页眉、索引、页脚和侧边栏,我只想要一个简单的侧边栏,显示最近的帖子和按日期浏览.欢迎任何帮助,谢谢.
I do not have a functions file i just have a header, index, footer and side bar,i am just wanting a simple sidebar that shows recent posts, and browsing by date. Any help is welcomed thanks.
哦,网站链接jp creative vision
推荐答案
这应该是最简单的方法,不用去 function.php 和所有,试试这个:
This should be easiest way without going to function.php and all, try this one:
创建一个带有侧边栏名称的 php 文件,例如具有此名称的 TEMP sidebar-TEMP.php(只需在侧边栏脚本前添加前缀 'sidebar-')
create a php file with name of your sidebar e.g TEMP with this name sidebar-TEMP.php (just add prefix 'sidebar-' before your sidebar script)
在该文件中放入您所有的侧边栏代码.
in that file put all your sidebar code.
并调用放置此代码:
<?php get_sidebar( 'TEMP' ); // (avoid your prefix here) ?>
谢谢.
这篇关于如何制作wordpress侧边栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!