首页特色图对齐方式可选
This commit is contained in:
parent
13c95549d7
commit
66379fd944
11
options.php
11
options.php
|
@ -253,6 +253,17 @@ function optionsframework_options() {
|
||||||
'square' => __('方形', '')
|
'square' => __('方形', '')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$options[] = array(
|
||||||
|
'name' => __('首页文章特色图对齐方式(仅对图文风格生效,默认左右交替)', 'akina'),
|
||||||
|
'id' => 'feature_align',
|
||||||
|
'std' => "alternate",
|
||||||
|
'type' => "radio",
|
||||||
|
'options' => array(
|
||||||
|
'left' => __('向左对齐', ''),
|
||||||
|
'right' => __('向右对齐', ''),
|
||||||
|
'alternate' => __('左右交替', '')
|
||||||
|
));
|
||||||
|
|
||||||
$options[] = array(
|
$options[] = array(
|
||||||
'name' => __('默认文章特色图', 'options_framework_theme'),
|
'name' => __('默认文章特色图', 'options_framework_theme'),
|
||||||
'desc' => __('在未设置文章特色图的情况下展示的默认图像,留空则调用本地随机封面(要展示的图片放入 /wp-content/themes/Sakura/feature/gallery/ 目录)', 'options_framework_theme'),
|
'desc' => __('在未设置文章特色图的情况下展示的默认图像,留空则调用本地随机封面(要展示的图片放入 /wp-content/themes/Sakura/feature/gallery/ 目录)', 'options_framework_theme'),
|
||||||
|
|
|
@ -11,7 +11,19 @@
|
||||||
//}
|
//}
|
||||||
//add_filter('the_excerpt', 'custom_short_excerpt');
|
//add_filter('the_excerpt', 'custom_short_excerpt');
|
||||||
$i=0; while ( have_posts() ) : the_post(); $i++;
|
$i=0; while ( have_posts() ) : the_post(); $i++;
|
||||||
|
switch (akina_option('feature_align')) {
|
||||||
|
case "left":
|
||||||
|
$class = 'post-list-thumb-left';
|
||||||
|
break;
|
||||||
|
case "right":
|
||||||
|
$class = '';
|
||||||
|
break;
|
||||||
|
case "alternate":
|
||||||
$class = ($i%2 == 0) ? 'post-list-thumb-left' : ''; // 如果为偶数
|
$class = ($i%2 == 0) ? 'post-list-thumb-left' : ''; // 如果为偶数
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$class = ($i%2 == 0) ? 'post-list-thumb-left' : '';
|
||||||
|
}
|
||||||
if(has_post_thumbnail()){
|
if(has_post_thumbnail()){
|
||||||
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large');
|
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large');
|
||||||
$post_img = $large_image_url[0];
|
$post_img = $large_image_url[0];
|
||||||
|
|
Loading…
Reference in New Issue