自定义WordPress主题widgets

将以下代码添加到functions.php:

function widget_footer_copyright() {
register_sidebar(array(
'id'=>'widget_footer_copyright',
'name'=>'页脚版权信息'
));
}
add_action('widgets_init','widget_footer_copyright');

在模板文件中使用:
<ul><?php dynamic_sidebar(‘widget_footer_copyright’); ?></ul>

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

You are commenting using your WordPress.com account. Log Out /  更改 )

Google photo

You are commenting using your Google account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )

Connecting to %s