Version Description
- New - Screen reader text is now optional, can be enabled in the options
- New - Added option to remove the "read more link" if the full post content is shown
- New - Title can be included in the "read more link" by adding {title} to the option
Download this release
Release Info
Developer | wpkube |
Plugin | Advanced Excerpt |
Version | 4.2.8 |
Comparing to | |
See all releases |
Code changes from version 4.2.7 to 4.2.8
- advanced-excerpt.php +2 -2
- class/advanced-excerpt.php +24 -7
- readme.txt +6 -1
- template/options.php +25 -5
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.8
|
7 |
Author: WPKube
|
8 |
Author URI: https://wpkube.com
|
9 |
*/
|
10 |
|
11 |
+
$GLOBALS['advanced_excerpt_version'] = '4.2.8';
|
12 |
|
13 |
function advanced_excerpt_load_textdomain() {
|
14 |
load_plugin_textdomain( 'advanced-excerpt', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
class/advanced-excerpt.php
CHANGED
@@ -17,6 +17,8 @@ class Advanced_Excerpt {
|
|
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,
|
@@ -283,9 +285,15 @@ class Advanced_Excerpt {
|
|
283 |
// Create the excerpt
|
284 |
$text = $this->text_excerpt( $text, $length, $length_type, $finish );
|
285 |
|
|
|
|
|
|
|
|
|
286 |
// Add the ellipsis or link
|
287 |
-
if ( !apply_filters( 'advanced_excerpt_disable_add_more', false, $text_before_trimming, $this->options ) ) {
|
288 |
-
|
|
|
|
|
289 |
}
|
290 |
|
291 |
return apply_filters( 'advanced_excerpt_content', $text );
|
@@ -331,15 +339,24 @@ class Advanced_Excerpt {
|
|
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
|
339 |
} else {
|
340 |
-
$link_template = apply_filters( 'advanced_excerpt_read_more_link_template', ' <a href="%1$s" class="read-more">%2$s
|
341 |
}
|
342 |
-
|
|
|
|
|
|
|
343 |
}
|
344 |
|
345 |
$pos = strrpos( $text, '</' );
|
@@ -373,7 +390,7 @@ class Advanced_Excerpt {
|
|
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;
|
17 |
'read_more' => 'Read the rest',
|
18 |
'add_link' => 0,
|
19 |
'link_new_tab' => 0,
|
20 |
+
'link_screen_reader' => 0,
|
21 |
+
'link_exclude_length' => 0,
|
22 |
'allowed_tags' => array(),
|
23 |
'the_excerpt' => 1,
|
24 |
'the_content' => 1,
|
285 |
// Create the excerpt
|
286 |
$text = $this->text_excerpt( $text, $length, $length_type, $finish );
|
287 |
|
288 |
+
// lengths
|
289 |
+
$text_length_before = strlen( trim( $text_before_trimming ) );
|
290 |
+
$text_length_after = strlen( trim( $text ) );
|
291 |
+
|
292 |
// Add the ellipsis or link
|
293 |
+
if ( ! apply_filters( 'advanced_excerpt_disable_add_more', false, $text_before_trimming, $this->options ) ) {
|
294 |
+
if ( ! $link_exclude_length || $text_length_after < $text_length_before ) {
|
295 |
+
$text = $this->text_add_more( $text, $ellipsis, ( $add_link ) ? $read_more : false, ( $link_new_tab ) ? true : false, ( $link_screen_reader ) ? true : false );
|
296 |
+
}
|
297 |
}
|
298 |
|
299 |
return apply_filters( 'advanced_excerpt_content', $text );
|
339 |
return trim( force_balance_tags( $out ) );
|
340 |
}
|
341 |
|
342 |
+
public function text_add_more( $text, $ellipsis, $read_more, $link_new_tab, $link_screen_reader ) {
|
343 |
|
344 |
if ( $read_more ) {
|
345 |
+
|
346 |
+
$screen_reader_html = '';
|
347 |
+
if ( $link_screen_reader ) {
|
348 |
+
$screen_reader_html = '<span class="screen-reader-text"> “' . get_the_title() . '”</span>';
|
349 |
+
}
|
350 |
+
|
351 |
if ( $link_new_tab ) {
|
352 |
+
$link_template = apply_filters( 'advanced_excerpt_read_more_link_template', ' <a href="%1$s" class="read-more" target="_blank">%2$s %3$s</a>', get_permalink(), $read_more );
|
353 |
} else {
|
354 |
+
$link_template = apply_filters( 'advanced_excerpt_read_more_link_template', ' <a href="%1$s" class="read-more">%2$s %3$s</a>', get_permalink(), $read_more );
|
355 |
}
|
356 |
+
|
357 |
+
$read_more = str_replace( '{title}', get_the_title(), $read_more );
|
358 |
+
$ellipsis .= sprintf( $link_template, get_permalink(), $read_more, $screen_reader_html );
|
359 |
+
|
360 |
}
|
361 |
|
362 |
$pos = strrpos( $text, '</' );
|
390 |
$_POST = stripslashes_deep( $_POST );
|
391 |
$this->options['length'] = (int) $_POST['length'];
|
392 |
|
393 |
+
$checkbox_options = array( 'no_custom', 'no_shortcode', 'add_link', 'link_new_tab', 'link_screen_reader', 'link_exclude_length', 'the_excerpt', 'the_content', 'the_content_no_break' );
|
394 |
|
395 |
foreach ( $checkbox_options as $checkbox_option ) {
|
396 |
$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,11 @@ However, you can [start The Loop manually](http://codex.wordpress.org/The_Loop#M
|
|
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
|
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.8
|
7 |
License: GPLv3
|
8 |
|
9 |
Control the appearance of WordPress post excerpts
|
96 |
|
97 |
== Changelog ==
|
98 |
|
99 |
+
= 4.2.8 =
|
100 |
+
* New - Screen reader text is now optional, can be enabled in the options
|
101 |
+
* New - Added option to remove the "read more link" if the full post content is shown
|
102 |
+
* New - Title can be included in the "read more link" by adding {title} to the option
|
103 |
+
|
104 |
= 4.2.7 =
|
105 |
* New - Option to open "read more" in a new tab
|
106 |
* New - Added screen reader text for "read more" link
|
template/options.php
CHANGED
@@ -70,15 +70,35 @@
|
|
70 |
<?php _e( "Read More Link:", 'advanced-excerpt' ); ?>
|
71 |
</th>
|
72 |
<td>
|
|
|
73 |
<label for="add-link">
|
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 |
-
|
78 |
-
<input name="
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
</td>
|
83 |
</tr>
|
84 |
<tr valign="top">
|
70 |
<?php _e( "Read More Link:", 'advanced-excerpt' ); ?>
|
71 |
</th>
|
72 |
<td>
|
73 |
+
|
74 |
<label for="add-link">
|
75 |
<input name="add_link" type="checkbox" id="add-link" value="on" <?php echo ( 1 == $add_link ) ? 'checked="checked"' : ''; ?> />
|
76 |
<?php _e( "Add read more link to excerpt", 'advanced-excerpt' ); ?>
|
77 |
</label><br />
|
78 |
+
|
79 |
+
<input name="read_more" type="text" id="read-more" value="<?php echo $read_more; ?>" <?php echo ( 1 !== $add_link ) ? 'disabled="disabled"' : ''; ?> /><br>
|
80 |
+
|
81 |
+
<ul class="sub-options">
|
82 |
+
<li>
|
83 |
+
<label for="link-new-tab">
|
84 |
+
<input name="link_new_tab" type="checkbox" id="link-new-tab" value="on" <?php echo ( 1 == $link_new_tab ) ? 'checked="checked"' : ''; ?> />
|
85 |
+
<?php _e( "Open read more link in new tab", 'advanced-excerpt' ); ?>
|
86 |
+
</label>
|
87 |
+
</li>
|
88 |
+
<li>
|
89 |
+
<label for="link-screen-reader">
|
90 |
+
<input name="link_screen_reader" type="checkbox" id="link-screen-reader" value="on" <?php echo ( 1 == $link_screen_reader ) ? 'checked="checked"' : ''; ?> />
|
91 |
+
<?php _e( "Screen readers compatibility", 'advanced-excerpt' ); ?> <span class="description"><?php _e( '(appends post title with class .screen-reader-text to the link)', 'advanced-excerpt' ); ?></span>
|
92 |
+
</label><br />
|
93 |
+
</li>
|
94 |
+
<li>
|
95 |
+
<label for="link-exclude-length">
|
96 |
+
<input name="link_exclude_length" type="checkbox" id="link-exclude-length" value="on" <?php echo ( 1 == $link_exclude_length ) ? 'checked="checked"' : ''; ?> />
|
97 |
+
<?php _e( "Remove link if the whole post content shown", 'advanced-excerpt' ); ?>
|
98 |
+
</label><br />
|
99 |
+
</li>
|
100 |
+
</ul>
|
101 |
+
|
102 |
</td>
|
103 |
</tr>
|
104 |
<tr valign="top">
|