Version Description
- New - Option to open "read more" in a new tab
- New - Added screen reader text for "read more" link
Download this release
Release Info
Developer | wpkube |
Plugin | Advanced Excerpt |
Version | 4.2.7 |
Comparing to | |
See all releases |
Code changes from version 4.2.6 to 4.2.7
- advanced-excerpt.php +2 -2
- class/advanced-excerpt.php +11 -5
- readme.txt +5 -1
- template/options.php +4 -0
advanced-excerpt.php
CHANGED
@@ -3,12 +3,12 @@
|
|
3 |
Plugin Name: Advanced Excerpt
|
4 |
Plugin URI: http://wordpress.org/plugins/advanced-excerpt/
|
5 |
Description: Control the appearance of WordPress post excerpts
|
6 |
-
Version: 4.2.
|
7 |
Author: WPKube
|
8 |
Author URI: https://wpkube.com
|
9 |
*/
|
10 |
|
11 |
-
$GLOBALS['advanced_excerpt_version'] = '4.2.
|
12 |
|
13 |
function advanced_excerpt_load_textdomain() {
|
14 |
load_plugin_textdomain( 'advanced-excerpt', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
3 |
Plugin Name: Advanced Excerpt
|
4 |
Plugin URI: http://wordpress.org/plugins/advanced-excerpt/
|
5 |
Description: Control the appearance of WordPress post excerpts
|
6 |
+
Version: 4.2.7
|
7 |
Author: WPKube
|
8 |
Author URI: https://wpkube.com
|
9 |
*/
|
10 |
|
11 |
+
$GLOBALS['advanced_excerpt_version'] = '4.2.7';
|
12 |
|
13 |
function advanced_excerpt_load_textdomain() {
|
14 |
load_plugin_textdomain( 'advanced-excerpt', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
class/advanced-excerpt.php
CHANGED
@@ -16,6 +16,7 @@ class Advanced_Excerpt {
|
|
16 |
'ellipsis' => '…',
|
17 |
'read_more' => 'Read the rest',
|
18 |
'add_link' => 0,
|
|
|
19 |
'allowed_tags' => array(),
|
20 |
'the_excerpt' => 1,
|
21 |
'the_content' => 1,
|
@@ -284,7 +285,7 @@ class Advanced_Excerpt {
|
|
284 |
|
285 |
// Add the ellipsis or link
|
286 |
if ( !apply_filters( 'advanced_excerpt_disable_add_more', false, $text_before_trimming, $this->options ) ) {
|
287 |
-
$text = $this->text_add_more( $text, $ellipsis, ( $add_link ) ? $read_more : false );
|
288 |
}
|
289 |
|
290 |
return apply_filters( 'advanced_excerpt_content', $text );
|
@@ -330,10 +331,15 @@ class Advanced_Excerpt {
|
|
330 |
return trim( force_balance_tags( $out ) );
|
331 |
}
|
332 |
|
333 |
-
public function text_add_more( $text, $ellipsis, $read_more ) {
|
|
|
334 |
if ( $read_more ) {
|
335 |
-
|
336 |
-
|
|
|
|
|
|
|
|
|
337 |
}
|
338 |
|
339 |
$pos = strrpos( $text, '</' );
|
@@ -367,7 +373,7 @@ class Advanced_Excerpt {
|
|
367 |
$_POST = stripslashes_deep( $_POST );
|
368 |
$this->options['length'] = (int) $_POST['length'];
|
369 |
|
370 |
-
$checkbox_options = array( 'no_custom', 'no_shortcode', 'add_link', 'the_excerpt', 'the_content', 'the_content_no_break' );
|
371 |
|
372 |
foreach ( $checkbox_options as $checkbox_option ) {
|
373 |
$this->options[$checkbox_option] = ( isset( $_POST[$checkbox_option] ) ) ? 1 : 0;
|
16 |
'ellipsis' => '…',
|
17 |
'read_more' => 'Read the rest',
|
18 |
'add_link' => 0,
|
19 |
+
'link_new_tab' => 0,
|
20 |
'allowed_tags' => array(),
|
21 |
'the_excerpt' => 1,
|
22 |
'the_content' => 1,
|
285 |
|
286 |
// Add the ellipsis or link
|
287 |
if ( !apply_filters( 'advanced_excerpt_disable_add_more', false, $text_before_trimming, $this->options ) ) {
|
288 |
+
$text = $this->text_add_more( $text, $ellipsis, ( $add_link ) ? $read_more : false, ( $link_new_tab ) ? true : false );
|
289 |
}
|
290 |
|
291 |
return apply_filters( 'advanced_excerpt_content', $text );
|
331 |
return trim( force_balance_tags( $out ) );
|
332 |
}
|
333 |
|
334 |
+
public function text_add_more( $text, $ellipsis, $read_more, $link_new_tab ) {
|
335 |
+
|
336 |
if ( $read_more ) {
|
337 |
+
if ( $link_new_tab ) {
|
338 |
+
$link_template = apply_filters( 'advanced_excerpt_read_more_link_template', ' <a href="%1$s" class="read-more" target="_blank">%2$s<span class="screen-reader-text"> “%3$s”</span></a>', get_permalink(), $read_more, get_the_title() );
|
339 |
+
} else {
|
340 |
+
$link_template = apply_filters( 'advanced_excerpt_read_more_link_template', ' <a href="%1$s" class="read-more">%2$s<span class="screen-reader-text"> “%3$s”</span></a>', get_permalink(), $read_more, get_the_title() );
|
341 |
+
}
|
342 |
+
$ellipsis .= sprintf( $link_template, get_permalink(), $read_more, get_the_title() );
|
343 |
}
|
344 |
|
345 |
$pos = strrpos( $text, '</' );
|
373 |
$_POST = stripslashes_deep( $_POST );
|
374 |
$this->options['length'] = (int) $_POST['length'];
|
375 |
|
376 |
+
$checkbox_options = array( 'no_custom', 'no_shortcode', 'add_link', 'link_new_tab', 'the_excerpt', 'the_content', 'the_content_no_break' );
|
377 |
|
378 |
foreach ( $checkbox_options as $checkbox_option ) {
|
379 |
$this->options[$checkbox_option] = ( isset( $_POST[$checkbox_option] ) ) ? 1 : 0;
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: fancythemes, WPKube
|
|
3 |
Tags: post excerpt, excerpt, post, content, formatting
|
4 |
Requires at least: 3.2
|
5 |
Tested up to: 5.1
|
6 |
-
Stable tag: 4.2.
|
7 |
License: GPLv3
|
8 |
|
9 |
Control the appearance of WordPress post excerpts
|
@@ -96,6 +96,10 @@ However, you can [start The Loop manually](http://codex.wordpress.org/The_Loop#M
|
|
96 |
|
97 |
== Changelog ==
|
98 |
|
|
|
|
|
|
|
|
|
99 |
= 4.2.6 =
|
100 |
* New "Finish" option that counts exact characters including blank spaces.
|
101 |
|
3 |
Tags: post excerpt, excerpt, post, content, formatting
|
4 |
Requires at least: 3.2
|
5 |
Tested up to: 5.1
|
6 |
+
Stable tag: 4.2.7
|
7 |
License: GPLv3
|
8 |
|
9 |
Control the appearance of WordPress post excerpts
|
96 |
|
97 |
== Changelog ==
|
98 |
|
99 |
+
= 4.2.7 =
|
100 |
+
* New - Option to open "read more" in a new tab
|
101 |
+
* New - Added screen reader text for "read more" link
|
102 |
+
|
103 |
= 4.2.6 =
|
104 |
* New "Finish" option that counts exact characters including blank spaces.
|
105 |
|
template/options.php
CHANGED
@@ -74,6 +74,10 @@
|
|
74 |
<input name="add_link" type="checkbox" id="add-link" value="on" <?php echo ( 1 == $add_link ) ? 'checked="checked"' : ''; ?> />
|
75 |
<?php _e( "Add read more link to excerpt", 'advanced-excerpt' ); ?>
|
76 |
</label><br />
|
|
|
|
|
|
|
|
|
77 |
<input name="read_more" type="text" id="read-more" value="<?php echo $read_more; ?>" <?php echo ( 1 !== $add_link ) ? 'disabled="disabled"' : ''; ?> />
|
78 |
</td>
|
79 |
</tr>
|
74 |
<input name="add_link" type="checkbox" id="add-link" value="on" <?php echo ( 1 == $add_link ) ? 'checked="checked"' : ''; ?> />
|
75 |
<?php _e( "Add read more link to excerpt", 'advanced-excerpt' ); ?>
|
76 |
</label><br />
|
77 |
+
<label for="link-new-tab">
|
78 |
+
<input name="link_new_tab" type="checkbox" id="link-new-tab" value="on" <?php echo ( 1 == $link_new_tab ) ? 'checked="checked"' : ''; ?> />
|
79 |
+
<?php _e( "Open read more link in new tab", 'advanced-excerpt' ); ?>
|
80 |
+
</label><br />
|
81 |
<input name="read_more" type="text" id="read-more" value="<?php echo $read_more; ?>" <?php echo ( 1 !== $add_link ) ? 'disabled="disabled"' : ''; ?> />
|
82 |
</td>
|
83 |
</tr>
|