mirror of
https://github.com/mashirozx/sakura.git
synced 2024-12-12 09:54:35 +08:00
首页特色图对齐方式可选
This commit is contained in:
parent
13c95549d7
commit
66379fd944
11
options.php
11
options.php
@ -252,6 +252,17 @@ function optionsframework_options() {
|
||||
'round' => __('圆形', ''),
|
||||
'square' => __('方形', '')
|
||||
));
|
||||
|
||||
$options[] = array(
|
||||
'name' => __('首页文章特色图对齐方式(仅对图文风格生效,默认左右交替)', 'akina'),
|
||||
'id' => 'feature_align',
|
||||
'std' => "alternate",
|
||||
'type' => "radio",
|
||||
'options' => array(
|
||||
'left' => __('向左对齐', ''),
|
||||
'right' => __('向右对齐', ''),
|
||||
'alternate' => __('左右交替', '')
|
||||
));
|
||||
|
||||
$options[] = array(
|
||||
'name' => __('默认文章特色图', 'options_framework_theme'),
|
||||
|
@ -11,7 +11,19 @@
|
||||
//}
|
||||
//add_filter('the_excerpt', 'custom_short_excerpt');
|
||||
$i=0; while ( have_posts() ) : the_post(); $i++;
|
||||
$class = ($i%2 == 0) ? 'post-list-thumb-left' : ''; // 如果为偶数
|
||||
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' : ''; // 如果为偶数
|
||||
break;
|
||||
default:
|
||||
$class = ($i%2 == 0) ? 'post-list-thumb-left' : '';
|
||||
}
|
||||
if(has_post_thumbnail()){
|
||||
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large');
|
||||
$post_img = $large_image_url[0];
|
||||
|
Loading…
Reference in New Issue
Block a user