话不多说,先上图
提示:提示,ripro广告小工具博主移植到日主题上,同宗的东西丢进去就能用。其他主题需要自己找对合适的位置。可能外层PHP还要补充一点。
#css
首先是样式,放到你主题的style.css内 注:css部分我有调整一些高度和行距字体等的值。日主题上显示更完美。
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/*添加AD小工具(移植自RIPRO)*/ nwp by:newwordpress.com .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文件内
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// CAO主题的广告展示小工具 CSF::createWidget( 'cao_widget_ads' , array ( 'title' => 'RIPRO-广告展示' , 'classname' => 'widget-adss' , 'description' => 'RIPRO主题的小工具,由nwp博客移植' , 'fields' => array ( array ( 'id' => '_color' , 'type' => 'color' , 'title' => '背景颜色' , 'default' => '#8d23dd' , ), array ( 'id' => '_title' , 'type' => 'text' , 'title' => '主标题' , 'default' => '向日葵全家桶' , ), array ( 'id' => '_desc' , 'type' => 'text' , 'title' => '描述' , 'default' => '聚合全网优质资源,尽在nwp!' , ), array ( 'id' => '_href' , 'type' => 'text' , 'title' => '链接地址' , 'default' => 'https://www.newwordpress.com/' , ), ), )); 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' ]; } } |
常见问题FAQ
- 美化包支持最新版本吗?
- 最新美化支持永久更新!