Lightning Advanced Unit - Version 2.4.0

Version Description

  • [ Add function ] Add archive page link to Post List Widget.
Download this release

Release Info

Developer kurudrive
Plugin Icon wp plugin Lightning Advanced Unit
Version 2.4.0
Comparing to
See all releases

Code changes from version 2.3.4 to 2.4.0

inc/widgets/widget-new-posts.php CHANGED
@@ -18,6 +18,21 @@ class WP_Widget_ltg_adv_post_list extends WP_Widget {
18
  );
19
  }
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  function widget( $args, $instance ) {
22
  global $is_contentsarea_posts_widget;
23
  $is_contentsarea_posts_widget = true;
@@ -29,12 +44,12 @@ class WP_Widget_ltg_adv_post_list extends WP_Widget {
29
  echo $args['before_title'];
30
  echo $instance['label'];
31
  echo $args['after_title'];
32
- }
33
 
34
  $count = ( isset( $instance['count'] ) && $instance['count'] ) ? $instance['count'] : 10;
35
  $post_type = ( isset( $instance['post_type'] ) && $instance['post_type'] ) ? $instance['post_type'] : 'post';
36
 
37
- if ( $instance['format'] ) {
38
  $this->_taxonomy_init( $post_type );
39
  }
40
 
@@ -73,6 +88,7 @@ class WP_Widget_ltg_adv_post_list extends WP_Widget {
73
  }
74
 
75
  endif;
 
76
  echo '</div>';
77
  echo $args['after_widget'];
78
 
@@ -124,7 +140,7 @@ class WP_Widget_ltg_adv_post_list extends WP_Widget {
124
 
125
  <div class="entry-body">
126
 
127
- <?php
128
  $lightning_adv_more_btn_txt = '<span class="btn btn-default btn-block">'. __('Read more', LIGHTNING_ADVANCED_TEXTDOMAIN ). '</span>';
129
  $more_btn = apply_filters( 'lightning-adv-more-btn-txt' ,$lightning_adv_more_btn_txt);
130
  global $is_pagewidget;
@@ -206,6 +222,8 @@ class WP_Widget_ltg_adv_post_list extends WP_Widget {
206
  'post_type' => 'post',
207
  'terms' => '',
208
  'format' => '0',
 
 
209
  );
210
 
211
  $instance = wp_parse_args( (array) $instance, $defaults );
@@ -240,7 +258,16 @@ class WP_Widget_ltg_adv_post_list extends WP_Widget {
240
  <?php _e( 'if you need filtering by term, add the term ID separate by ",".', LIGHTNING_ADVANCED_TEXTDOMAIN );
241
  echo '<br/>';
242
  _e( 'if empty this area, I will do not filtering.', LIGHTNING_ADVANCED_TEXTDOMAIN );
243
- echo '<br/><br/>';
 
 
 
 
 
 
 
 
 
244
  }
245
 
246
  function update( $new_instance, $old_instance ) {
@@ -250,6 +277,8 @@ class WP_Widget_ltg_adv_post_list extends WP_Widget {
250
  $instance['label'] = $new_instance['label'];
251
  $instance['post_type'] = ! empty( $new_instance['post_type'] ) ? strip_tags( $new_instance['post_type'] ) : 'post';
252
  $instance['terms'] = preg_replace( '/([^0-9,]+)/', '', $new_instance['terms'] );
 
 
253
  return $instance;
254
  }
255
  }
18
  );
19
  }
20
 
21
+ /*-------------------------------------------*/
22
+ /* 一覧へのリンクhtmlを出力する関数
23
+ /*-------------------------------------------*/
24
+ static public function more_link_html( $instance )
25
+ {
26
+ if ( ! empty ( $instance['more_text'] ) && ! empty ( $instance['more_url'] )) {
27
+ $more_link_html = '<div class="text-right" style="margin-top:1em;">';
28
+ $more_link_html .= '<a href="'.esc_url( $instance['more_url'] ).'" class="btn btn-default btn-xs">'.wp_kses_post( $instance['more_text'] ).'</a>';
29
+ $more_link_html .= '</div>';
30
+ } else {
31
+ $more_link_html = '';
32
+ }
33
+ return $more_link_html;
34
+ }
35
+
36
  function widget( $args, $instance ) {
37
  global $is_contentsarea_posts_widget;
38
  $is_contentsarea_posts_widget = true;
44
  echo $args['before_title'];
45
  echo $instance['label'];
46
  echo $args['after_title'];
47
+ }
48
 
49
  $count = ( isset( $instance['count'] ) && $instance['count'] ) ? $instance['count'] : 10;
50
  $post_type = ( isset( $instance['post_type'] ) && $instance['post_type'] ) ? $instance['post_type'] : 'post';
51
 
52
+ if ( $instance['format'] ) {
53
  $this->_taxonomy_init( $post_type );
54
  }
55
 
88
  }
89
 
90
  endif;
91
+ echo $this->more_link_html( $instance );
92
  echo '</div>';
93
  echo $args['after_widget'];
94
 
140
 
141
  <div class="entry-body">
142
 
143
+ <?php
144
  $lightning_adv_more_btn_txt = '<span class="btn btn-default btn-block">'. __('Read more', LIGHTNING_ADVANCED_TEXTDOMAIN ). '</span>';
145
  $more_btn = apply_filters( 'lightning-adv-more-btn-txt' ,$lightning_adv_more_btn_txt);
146
  global $is_pagewidget;
222
  'post_type' => 'post',
223
  'terms' => '',
224
  'format' => '0',
225
+ 'more_url' => '',
226
+ 'more_text' => '',
227
  );
228
 
229
  $instance = wp_parse_args( (array) $instance, $defaults );
258
  <?php _e( 'if you need filtering by term, add the term ID separate by ",".', LIGHTNING_ADVANCED_TEXTDOMAIN );
259
  echo '<br/>';
260
  _e( 'if empty this area, I will do not filtering.', LIGHTNING_ADVANCED_TEXTDOMAIN );
261
+ echo '<br/><br/>';?>
262
+
263
+ <?php // Read more ?>
264
+ <label for="<?php echo $this->get_field_id( 'more_url' ); ?>"><?php _e( 'Destination URL:', 'vkExUnit' ); ?></label><br/>
265
+ <input type="text" id="<?php echo $this->get_field_id( 'more_url' ); ?>" name="<?php echo $this->get_field_name( 'more_url' ); ?>" value="<?php echo esc_attr( $instance['more_url'] ); ?>" />
266
+ <br /><br />
267
+ <label for="<?php echo $this->get_field_id( 'more_text' ); ?>"><?php _e( 'Notation text:', 'vkExUnit' ); ?></label><br/>
268
+ <input type="text" placeholder="最新記事一覧 ≫" id="<?php echo $this->get_field_id( 'more_text' ); ?>" name="<?php echo $this->get_field_name( 'more_text' ); ?>" value="<?php echo esc_attr( $instance['more_text'] ); ?>" />
269
+ <br /><br />
270
+ <?php
271
  }
272
 
273
  function update( $new_instance, $old_instance ) {
277
  $instance['label'] = $new_instance['label'];
278
  $instance['post_type'] = ! empty( $new_instance['post_type'] ) ? strip_tags( $new_instance['post_type'] ) : 'post';
279
  $instance['terms'] = preg_replace( '/([^0-9,]+)/', '', $new_instance['terms'] );
280
+ $instance['more_url'] = $new_instance['more_url'];
281
+ $instance['more_text'] = $new_instance['more_text'];
282
  return $instance;
283
  }
284
  }
lightning_advanced_unit.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Lightning Advanced Unit
4
  * Plugin URI: http://lightning.vektor-inc.co.jp/
5
- * Version: 2.3.4
6
  * Author: Vektor,Inc.
7
  * Author URI: http://www.vektor-inc.co.jp
8
  * Description: This is a plug-ins that extend the functionality of the theme "Lightning".
2
  /**
3
  * Plugin Name: Lightning Advanced Unit
4
  * Plugin URI: http://lightning.vektor-inc.co.jp/
5
+ * Version: 2.4.0
6
  * Author: Vektor,Inc.
7
  * Author URI: http://www.vektor-inc.co.jp
8
  * Description: This is a plug-ins that extend the functionality of the theme "Lightning".
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: Lightning,
5
  Requires at least: 4.2
6
  Tested up to: 4.7.0
7
- Stable tag: 2.3.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -44,6 +44,9 @@ e.g.
44
 
45
  == Changelog ==
46
 
 
 
 
47
  = 2.2.0 =
48
  * [ Specification change ] When active Origin Pro or Variety that, labal color active.
49
 
4
  Tags: Lightning,
5
  Requires at least: 4.2
6
  Tested up to: 4.7.0
7
+ Stable tag: 2.4.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
44
 
45
  == Changelog ==
46
 
47
+ = 2.4.0 =
48
+ * [ Add function ] Add archive page link to Post List Widget.
49
+
50
  = 2.2.0 =
51
  * [ Specification change ] When active Origin Pro or Variety that, labal color active.
52