mirror of
https://github.com/mashirozx/sakura.git
synced 2024-11-21 22:38:12 +08:00
feat: make feature image separate
only for the post without feature image in the home page issue #237
This commit is contained in:
parent
00e2a2f390
commit
69b68c00c0
@ -120,7 +120,12 @@ function cover_gallery() {
|
|||||||
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/feature
|
* @rest api接口路径:https://sakura.2heng.xin/wp-json/sakura/v1/image/feature
|
||||||
*/
|
*/
|
||||||
function feature_gallery() {
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -162,4 +162,13 @@ class Images
|
|||||||
}
|
}
|
||||||
return $imgurl;
|
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
19
options.php
19
options.php
@ -234,6 +234,25 @@ function optionsframework_options()
|
|||||||
'imageflow' => __('Graphic', 'sakura'), /*图文*/
|
'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(
|
$options[] = array(
|
||||||
'name' => __('Home article feature images (only valid for standard mode)', 'sakura'), /*首页文章特色图(仅对标准风格生效)*/
|
'name' => __('Home article feature images (only valid for standard mode)', 'sakura'), /*首页文章特色图(仅对标准风格生效)*/
|
||||||
'id' => 'list_type',
|
'id' => 'list_type',
|
||||||
|
Loading…
Reference in New Issue
Block a user