feat: make feature image separate

only for the post without feature image in the home page
issue #237
pull/239/head
Spirit 2020-08-06 17:52:27 +08:00
parent 00e2a2f390
commit 69b68c00c0
8 changed files with 1042 additions and 969 deletions

View File

@ -120,7 +120,12 @@ function cover_gallery() {
* @rest api接口路径https://sakura.2heng.xin/wp-json/sakura/v1/image/feature
*/
function feature_gallery() {
return cover_gallery();
$imgurl = Images::feature_gallery();
$data = array('feature image');
$response = new WP_REST_Response($data);
$response->set_status(302);
$response->header('Location', $imgurl);
return $response;
}
/*

View File

@ -162,4 +162,13 @@ class Images
}
return $imgurl;
}
public static function feature_gallery() {
if (akina_option('post_cover_options') == "type_2") {
$imgurl = akina_option('post_cover');
} else {
$imgurl = self::cover_gallery();
}
return $imgurl;
}
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -234,6 +234,25 @@ function optionsframework_options()
'imageflow' => __('Graphic', 'sakura'), /*图文*/
));
$options[] = array(
'name' => __('Cover manifest', 'sakura'), /*首页文章特色图选项*/
'desc' => __('Select how to call the post featue image, only for the post without feature image', 'sakura'), /*选择文章特色图的调用方式,只对没有设置特色图像的文章生效*/
'id' => 'post_cover_options',
'std' => "type_1",
'type' => "select",
'options' => array(
'type_1' => __('same as the cover of the first screen (default)', 'sakura'), /*跟随第一屏封面图*/
'type_2' => __('custom api (advanced)', 'sakura'), /*外部随机图API*/
)
);
$options[] = array(
'name' => __('Cover images url', 'sakura'), /*图片库url*/
'desc' => __('Fill in the custom image api url.', 'sakura'),
'id' => 'post_cover',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Home article feature images (only valid for standard mode)', 'sakura'), /*首页文章特色图(仅对标准风格生效)*/
'id' => 'list_type',