ZanBlog3.1幻灯片插件二次开发应用

来源:互联网 发布:idea uml生成java代码 编辑:程序博客网 时间:2024/05/16 05:13
<?php/** * ZanBlog 幻灯片组件 * * @package    ZanBlog * @subpackage Widget */ class Zan_Slide extends WP_Widget {  // 设定小工具信息  function Zan_Slide() {    $widget_options = array(          'name'        => '幻灯片组件(ZanBlog)',           'description' => 'ZanBlog 幻灯片组件'     );    parent::WP_Widget( false, false, $widget_options );    }  // 设定小工具结构  function widget( $args, $instance ) {    extract( $args );    @$id = $instance['id'] ? $instance['id'] : '';    $args = array(      'numberposts' => 6, // 最多获取6篇文章作为幻灯片      'category' => $id,    );    $postQuery = get_posts( $args );    echo $before_widget;    ?>    <div class="flexslider hidden-xs">      <ul class="slides">      <?php          foreach ( $postQuery as $post ) {      ?>        <li>                         <div class="col-md-12">                             <div class="row">     <div class="col-md-8">                                         <a href="<?php echo get_permalink($post->ID);?>">                                        <?php echo get_the_post_thumbnail($post->ID, array(500,230)); ?>                                        </a>                                     </div>    <div class="col-md-4">    <a href="<?php echo get_permalink($post->ID);?>">                                                       <div style="font-size:15px;"><?php echo $post->post_title ?>                                                       </div>                                                  </a><br/>     <div style="font-size:14px;"><?php echo wp_trim_words($post->post_excerpt,50);?></div>    </div>                              </div>    </div>        </li>      <?php          }      ?>      </ul>    </div>    <?php    echo $after_widget;  }  function update( $new_instance, $old_instance ) {                     return $new_instance;  }  function form( $instance ) {            @$id = esc_attr( $instance['id'] );    ?>      <p>        <label for="<?php echo $this->get_field_id( 'id' ); ?>">          文章分类ID:          <input class="widefat"  name="<?php echo $this->get_field_name( 'id' ); ?>" type="text" value="<?php echo $id; ?>" />        </label>      </p>    <?php   }} register_widget( 'Zan_Slide' );?>
/** * 在这里自定义你的CSS代码 */.zan-outline {color: #110E0E;}.header .logo {border-radius:20%;}nav.navbar-inverse .navbar-nav .avatar-and-username{padding-top: 5px;    padding-bottom: 0px;margin-left: 2px;}nav.navbar-inverse .navbar-nav .avatar-and-username img {border-radius: 50%;}nav.navbar-inverse .navbar-nav .avatar-and-username img:hover {-webkit-transition: all .3s ease-in-out;-moz-transition: all .3s ease-in-out;-o-transition: all .3s ease-in-out;transition: all .3s ease-in-out;transform: rotate(360deg);-moz-transform: rotate(360deg);-webkit-transform: rotate(360deg);}.navbar-form .form-control {border-color: #16a085;}.navbar-form .form-control:focus {border-color: #16a085;background-color: white!important;outline: 0;box-shadow: none;-webkit-transition: all .3s ease;-moz-transition: all .3s ease;-o-transition: all .3s ease;transition: all .3s ease;}


0 0
原创粉丝点击