Skip to content

Commit

Permalink
增加广告位
Browse files Browse the repository at this point in the history
  • Loading branch information
owen0o0 committed Dec 7, 2019
1 parent 0d94f4a commit e86e43c
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 5 deletions.
10 changes: 7 additions & 3 deletions css/nav.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions inc/frame/config/framework.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,70 @@
),
)
);
// ----------------------------------------
// 添加广告-------------------------------
// ----------------------------------------
$options[] = array(
'name' => 'ad',
'title' => '添加广告',
'icon' => 'fa fa-google',
'fields' => array(
array(
'id' => 'ad_home_s',
'type' => 'switcher',
'title' => '首页顶部广告位',
'default' => false,
),
array(
'id' => 'ad_right_s',
'type' => 'switcher',
'title' => '详情页右边广告位',
'default' => true,
),
array(
'id' => 'ad_footer_s',
'type' => 'switcher',
'title' => 'footer广告位',
'default' => false,
),
array(
'id' => 'ad_home',
'type' => 'wysiwyg',
'title' => '首页顶部广告位内容',
'default' => '<a href="https://www.iowen.cn/wordpress-version-webstack/" target="_blank"><img src="' . get_template_directory_uri() . '/screenshot.jpg" alt="广告也精彩" /></a>',
'settings' => array(
'textarea_rows' => 5,
'tinymce' => false,
'media_buttons' => false,
),
'dependency' => array( 'ad_home_s', '==', true )
),
array(
'id' => 'ad_right',
'type' => 'wysiwyg',
'title' => '详情页右边广告位内容',
'default' => '<a href="https://www.iowen.cn/wordpress-version-webstack/" target="_blank"><img src="' . get_template_directory_uri() . '/screenshot.jpg" alt="广告也精彩" /></a>',
'settings' => array(
'textarea_rows' => 5,
'tinymce' => false,
'media_buttons' => false,
),
'dependency' => array( 'ad_right_s', '==', true )
),
array(
'id' => 'ad_footer',
'type' => 'wysiwyg',
'title' => 'footer广告位内容',
'default' => '<a href="https://www.iowen.cn/wordpress-version-webstack/" target="_blank"><img src="' . get_template_directory_uri() . '/screenshot.jpg" alt="广告也精彩" /></a>',
'settings' => array(
'textarea_rows' => 5,
'tinymce' => false,
'media_buttons' => false,
),
'dependency' => array( 'ad_footer_s', '==', true )
),
)
);

// ----------------------------------------
// 优化加速-------------------------------
Expand Down
3 changes: 3 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@
<div class="no-search"></div>
<?php
}
?>

<?php if(!wp_is_mobile() && io_get_option('ad_home_s')) echo '<div class="ad ad-home">' . stripslashes( io_get_option('ad_home') ) . '</div>'; ?>

<?php
foreach($categories as $category) {
if($category->category_parent == 0){
$children = get_categories(array(
Expand Down
11 changes: 10 additions & 1 deletion single-sites.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<img class="img-cover" src="<?php echo $imgurl ?>" alt="<?php echo $sitetitle ?>" title="<?php echo $sitetitle ?>">
</div>
</div>
<div class="col-12 col-sm-8 col-lg-9 mt-4 mt-md-0">
<div class="col-12 col-sm-8 col-lg-5 mt-4 mt-md-0">
<div class="site-body p-xl-4">
<?php
$terms = get_the_terms( get_the_ID(), 'favorites' );
Expand Down Expand Up @@ -73,6 +73,11 @@

</div>
</div>
<div class="col-12 col-sm-12 col-lg-4 mt-4 mt-lg-0">

<?php if(io_get_option('ad_right_s')) echo '<div class="ad ad-right">' . stripslashes( io_get_option('ad_right') ) . '</div>'; ?>

</div>
</div>
<div class="mt-4 pt-4 border-top">
<?php
Expand Down Expand Up @@ -129,6 +134,10 @@
<br />

</div>

<?php if(io_get_option('ad_footer_s')) echo '<div class="ad ad-footer">' . stripslashes( io_get_option('ad_footer') ) . '</div>'; ?>

</div>

</div>
<?php get_footer(); ?>
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Theme Name:WebStack
Theme URI:https://www.iowen.cn
Description:by 一为!官方网站:<a href="https://www.iowen.cn">一为忆</a>
Version:1.1206
Version:1.1207
Author:iowen
Author URI: https://www.iowen.cn/
*/

0 comments on commit e86e43c

Please sign in to comment.