日期:2014-05-16  浏览次数:20398 次

wordpress侧边栏怎么调用的文章列表,看了很久一直不能理解
WordPress 3.7.1简体中文版,wordpress侧边栏怎么调用的文章列表

我下的一个主题中的sidebar.php

<div id="primary" class="sidebar grid_5 pull_10">
<ul class="">
<?php if ( is_active_sidebar( 'sidebartop' ) ) : ?>
        <?php dynamic_sidebar( 'sidebartop' ); ?>
<?php endif; // end primary sidebar widgets  ?>
</ul>

</div><!-- #primary .sidebar -->

<div id="secondary" class="sidebar grid_5 pull_10">
<ul class="">
<?php if ( is_active_sidebar( 'sidebarbottom' ) ) : ?>
        <?php dynamic_sidebar( 'sidebarbottom' ); ?>
<?php endif; // end secondary sidebar widgets  ?>
</ul>
    
</div><!-- #secondary .sidebar -->


dynamic_sidebar( 'sidebartop' ) 这个函数调用的最新文章列表?

sidebartop注册是在functions.php中,然后后台才有显示,如下:

register_sidebar(array(
'name' => 'SidebarTop',
'description' => 'Top sidebar',
'id'            => 'sidebartop',
'before_widget'  =>   "\n\t\t\t" . '<li id="%1$s" class="widget %2$s"><div class="widgetblock">',
'after_widget'   =>   "\n\t\t\t</div></li>\n",
'before_title'   =>   "\n\t\t\t\t". '<div class="widgettitleb"><h3 class="widgettitle">',
'after_title'    =>   "</h3></div>\n" .''
));



------解决方案--------------------
引用:
Quote: 引用:

这是调用侧边栏widgt

代码你要看wordpress核心函数,看主题里面的代码是看不到的


我下载了一个主题,但想让侧边栏布局更加好看一点,比如显示3条最近更新的文章,标题不会过长,这需要需改哪里呢?


自己在侧边栏写代码:
上网查下wordpress query_posts()函数的用法,你就知道了。如果有帮助,给分咯!