mirror of https://github.com/vtrois/kratos
feat: add more ad position (#394)
parent
fd21cb73c4
commit
56a16859d6
Binary file not shown.
Before Width: | Height: | Size: 603 B |
|
@ -1006,75 +1006,81 @@ CSF::createSection($prefix, array(
|
||||||
'icon' => 'fas fa-arrow-right',
|
'icon' => 'fas fa-arrow-right',
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
array(
|
array(
|
||||||
'id' => 's_singletop_fieldset',
|
'id' => 'single_ad_top_group',
|
||||||
'type' => 'fieldset',
|
'type' => 'group',
|
||||||
|
'title' => '文章顶部广告',
|
||||||
|
'subtitle' => '点击添加广告,最多添加 3 个顶部广告',
|
||||||
|
'min' => 1,
|
||||||
|
'max' => 3,
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
array(
|
array(
|
||||||
'type' => 'subheading',
|
'id' => 'ad_id',
|
||||||
'content' => __('文章顶部广告', 'kratos'),
|
'type' => 'text',
|
||||||
|
'title' => __('唯一标识', 'kratos'),
|
||||||
|
'subtitle' => __('仅用于识别广告内容,可以作为备注使用', 'kratos'),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 's_singletop',
|
'id' => 'ad_img',
|
||||||
'type' => 'switcher',
|
|
||||||
'title' => __('功能开关', 'kratos'),
|
|
||||||
'subtitle' => __('开启/关闭文章顶部广告', 'kratos'),
|
|
||||||
'text_on' => __('开启', 'kratos'),
|
|
||||||
'text_off' => __('关闭', 'kratos'),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'id' => 's_singletop_img',
|
|
||||||
'type' => 'upload',
|
'type' => 'upload',
|
||||||
'title' => __('广告图片', 'kratos'),
|
'title' => __('轮播图片', 'kratos'),
|
||||||
|
'subtitle' => __('可以直接填写图片链接,也可以上传图片', 'kratos'),
|
||||||
'library' => 'image',
|
'library' => 'image',
|
||||||
'preview' => true,
|
'preview' => true,
|
||||||
'subtitle' => __('仅当开启此功能时生效', 'kratos'),
|
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 's_singletop_url',
|
'id' => 'ad_url',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'title' => __('广告链接', 'kratos'),
|
'title' => __('网址链接', 'kratos'),
|
||||||
'subtitle' => __('如果不填写,将只显示图片', 'kratos'),
|
'subtitle' => __('需要填写完整的链接地址,包含协议头', 'kratos'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'id' => 'ad_switcher',
|
||||||
|
'type' => 'switcher',
|
||||||
|
'title' => __('功能开关', 'kratos'),
|
||||||
|
'subtitle' => __('开启/关闭此条广告', 'kratos'),
|
||||||
|
'text_on' => __('开启', 'kratos'),
|
||||||
|
'text_off' => __('关闭', 'kratos'),
|
||||||
|
'default' => true
|
||||||
),
|
),
|
||||||
),
|
|
||||||
'default' => array(
|
|
||||||
's_singletop' => false,
|
|
||||||
's_singletop_img' => get_template_directory_uri() . '/assets/img/ad.png',
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 's_singledown_fieldset',
|
'id' => 'single_ad_bottom_group',
|
||||||
'type' => 'fieldset',
|
'type' => 'group',
|
||||||
|
'title' => '文章底部广告',
|
||||||
|
'subtitle' => '点击添加广告,最多添加 3 个顶部广告',
|
||||||
|
'min' => 1,
|
||||||
|
'max' => 3,
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
array(
|
array(
|
||||||
'type' => 'subheading',
|
'id' => 'ad_id',
|
||||||
'content' => __('文章底部广告', 'kratos'),
|
'type' => 'text',
|
||||||
|
'title' => __('唯一标识', 'kratos'),
|
||||||
|
'subtitle' => __('仅用于识别广告内容,可以作为备注使用', 'kratos'),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 's_singledown',
|
'id' => 'ad_img',
|
||||||
'type' => 'switcher',
|
|
||||||
'title' => __('功能开关', 'kratos'),
|
|
||||||
'subtitle' => __('开启/关闭文章底部广告', 'kratos'),
|
|
||||||
'text_on' => __('开启', 'kratos'),
|
|
||||||
'text_off' => __('关闭', 'kratos'),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'id' => 's_singledown_img',
|
|
||||||
'type' => 'upload',
|
'type' => 'upload',
|
||||||
'title' => __('广告图片', 'kratos'),
|
'title' => __('轮播图片', 'kratos'),
|
||||||
|
'subtitle' => __('可以直接填写图片链接,也可以上传图片', 'kratos'),
|
||||||
'library' => 'image',
|
'library' => 'image',
|
||||||
'preview' => true,
|
'preview' => true,
|
||||||
'subtitle' => __('仅当开启此功能时生效', 'kratos'),
|
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 's_singledown_url',
|
'id' => 'ad_url',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'title' => __('广告链接', 'kratos'),
|
'title' => __('网址链接', 'kratos'),
|
||||||
'subtitle' => __('如果不填写,将只显示图片', 'kratos'),
|
'subtitle' => __('需要填写完整的链接地址,包含协议头', 'kratos'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'id' => 'ad_switcher',
|
||||||
|
'type' => 'switcher',
|
||||||
|
'title' => __('功能开关', 'kratos'),
|
||||||
|
'subtitle' => __('开启/关闭此条广告', 'kratos'),
|
||||||
|
'text_on' => __('开启', 'kratos'),
|
||||||
|
'text_off' => __('关闭', 'kratos'),
|
||||||
|
'default' => true
|
||||||
),
|
),
|
||||||
),
|
|
||||||
'default' => array(
|
|
||||||
's_singledown' => false,
|
|
||||||
's_singledown_img' => get_template_directory_uri() . '/assets/img/ad.png',
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
24
single.php
24
single.php
|
@ -74,13 +74,11 @@ $select_col = $col_array[kratos_option('g_article_widgets', 'two_side')];
|
||||||
</div>
|
</div>
|
||||||
<div class="content" id="lightgallery">
|
<div class="content" id="lightgallery">
|
||||||
<?php
|
<?php
|
||||||
if (kratos_option('s_singletop', false)) {
|
if (!empty(kratos_option('single_ad_top_group'))) {
|
||||||
if (kratos_option('s_singletop_url')) {
|
foreach (kratos_option('single_ad_top_group') as $group_item) {
|
||||||
echo '<a href="' . kratos_option('s_singletop_url') . '" target="_blank" rel="noreferrer">';
|
if ($group_item['ad_switcher']) {
|
||||||
}
|
echo '<div style="margin-bottom:5px"><a href="' . $group_item['ad_url'] . '" target="_blank" rel="noreferrer"><img src="' . $group_item['ad_img'] . '"></a></div>';
|
||||||
echo '<img src="' . kratos_option('s_singletop_img') . '">';
|
}
|
||||||
if (kratos_option('s_singletop_url')) {
|
|
||||||
echo '</a>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
the_content();
|
the_content();
|
||||||
|
@ -111,13 +109,11 @@ $select_col = $col_array[kratos_option('g_article_widgets', 'two_side')];
|
||||||
'nextpagelink' => __('<span>下一页</span>', 'kratos')
|
'nextpagelink' => __('<span>下一页</span>', 'kratos')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if (kratos_option('s_singledown', false)) {
|
if (!empty(kratos_option('single_ad_bottom_group'))) {
|
||||||
if (kratos_option('s_singledown_url')) {
|
foreach (kratos_option('single_ad_bottom_group') as $group_item) {
|
||||||
echo '<a href="' . kratos_option('s_singledown_url') . '" target="_blank" rel="noreferrer">';
|
if ($group_item['ad_switcher']) {
|
||||||
}
|
echo '<div style="margin-bottom:5px"><a href="' . $group_item['ad_url'] . '" target="_blank" rel="noreferrer"><img src="' . $group_item['ad_img'] . '"></a></div>';
|
||||||
echo '<img src="' . kratos_option('s_singledown_img') . '">';
|
}
|
||||||
if (kratos_option('s_singledown_url')) {
|
|
||||||
echo '</a>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue