加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
functions.php 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
xiaoluan 提交于 2016-09-08 16:34 . 想把主题传到wordpress官网真难
<?php
/**
* Filter the except length to 20 characters.
*
* @param int $length Excerpt length.
* @return int (Maybe) modified excerpt length.
*/
function wpdocs_custom_excerpt_length( $length ) {
return 150;
}
add_filter( 'excerpt_length', 'wpdocs_custom_excerpt_length', 300 );
/**
* Filter the excerpt "read more" string.
*
* @param string $more "Read more" excerpt string.
* @return string (Maybe) modified "read more" excerpt string.
*/
function wpdocs_excerpt_more( $more ) {
return '......';
}
add_filter( 'excerpt_more', 'wpdocs_excerpt_more' );
// 支持自定义侧栏
function theme_slug_widgets_init() {
register_sidebar( array(
'name' => __( 'Main Sidebar', 'theme-slug' ),
'id' => 'sidebar-1',
'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'theme-slug' ),
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'theme_slug_widgets_init' );
add_theme_support( 'post-thumbnails' );
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化