日主题 PRO 广告小工具
AD广告移植自RIPRO,效果如下图
代码:
提示,ripro广告小工具博主移植到日主题上,同宗的东西丢进去就能用。其他主题需要自己找对合适的位置。可能外层PHP还要补充一点。
#css
首先是样式,放到你主题的style.css内 注:css部分我有调整一些高度和行距字体等的值。日主题上显示更完美。
/*添加AD小工具(移植自RIPRO)*/ 向日葵全家桶 by:zmki.cn 2020年2月4日14:19:03
.btn-outline {
color: #fff!important;
background-color: transparent!important;
border: 1px solid #fff!important;
margin-top: 15px;
}
.widget-adss {
overflow: hidden;
padding: 0!important;
border-radius: 0!important;
}
.widget-adss .asr {
display: block;
padding: 40px 15px;
text-align: center;
color: #fff !important;
background: #64ddbb;
border-radius:4px ;
}
#小工具代码
放到日主题的/inc/codestar-framework/rizhuti
下的widgets.rizhuti.php
文件内
// CAO主题的广告展示小工具
CSF::createWidget('cao_widget_ads', array(
'title' => 'RIPRO-广告展示',
'classname' => 'widget-adss',
'description' => 'RIPRO主题的小工具,由钻芒博客移植',
'fields' => array(
array(
'id' => '_color',
'type' => 'color',
'title' => '背景颜色',
'default' => '#8d23dd',
),
array(
'id' => '_title',
'type' => 'text',
'title' => '主标题',
'default' => '向日葵全家桶',
),
array(
'id' => '_desc',
'type' => 'text',
'title' => '描述',
'default' => '聚合全网优质资源,尽在向日葵!',
),
array(
'id' => '_href',
'type' => 'text',
'title' => '链接地址',
'default' => 'http://www.K1v.cn/',
),
),
));
if (!function_exists('cao_widget_ads')) {
function cao_widget_ads($args, $instance)
{
echo $args['before_widget'];
// if ( ! empty( $instance['title'] ) ) {
// echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
// }
// start
$_color = $instance['_color'];
$_title = $instance['_title'];
$_desc = $instance['_desc'];
$_href = $instance['_href'];
echo '<div class="adsbg">';
echo '<a class="asr" href="'.$_href.'" target="_blank" style="background-color:'.$_color.'">';
echo '<h4 style="font-size: 20px;">'.$_title.'</h4>';
echo '<h5 style="font-weight: 100;">'.$_desc.'</h5>';
echo '<span class="btn btn-outline">立即查看</span>';
echo '</a>';
echo '</div>';
// end
echo $args['after_widget'];
}
}
感谢您的来访,获取更多精彩文章请收藏本站。
© 版权声明
THE END
请登录后查看评论内容