支持webp图片格式
在functions.php最后加入代码
function mimvp_filter_mime_types( $array ) {
$array['webp'] = 'image/webp';
return $array;
}
add_filter( 'mime_types', 'mimvp_filter_mime_types', 10, 1 );
function mimvp_file_is_displayable_image($result, $path) {
$info = @getimagesize( $path );
if($info['mime'] == 'image/webp') {
$result = true;
}
return $result;
}
add_filter( 'file_is_displayable_image', 'mimvp_file_is_displayable_image', 10, 2 );
首页显示摘要
修改template-parts\post\content.php文件
<div class="entry-content">
<?php
the_content(
sprintf(
/* translators: %s: Post title. */
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
get_the_title()
)
);
wp_link_pages(
array(
'before' => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
'after' => '</div>',
'link_before' => '<span class="page-number">',
'link_after' => '</span>',
)
);
?>
</div><!-- .entry-content -->
修改为
<div class="entry-content">
<?php if(!is_single()) {
the_excerpt();
} else {
the_content(__('(more…)'));
}
?>
</div><!-- .entry-content -->
CSS
assets\css\blocks.css
文件最后添加内容
.entry-content .has-vivid-purple-color {
color: #9b51e0;
}
.entry-content
.has-vivid-purple-background-color,
.wp-block-button.is-style-outline .has-vivid-purple-background-color:link {
background-color: #9b51e0;
}
注释/* File */下的.wp-block-file .wp-block-file__button {下的margin-top: 2em;
部分内容登录可见
在主题的functions.php文件添加以下代码:
//部分内容登录可见
add_shortcode('hide','loginvisible');
function loginvisible($atts,$content=null){
if(is_user_logged_in() && !is_null($content) && !is_feed())
return $content;
return '';
}