WP Show Posts - Version 0.9

Version Description

  • Fix bug where terms weren't saving
  • Strip oembed URLs from excerpt
Download this release

Release Info

Developer edge22
Plugin Icon 128x128 WP Show Posts
Version 0.9
Comparing to
See all releases

Code changes from version 0.8 to 0.9

admin/js/admin-scripts.js CHANGED
@@ -1,4 +1,4 @@
1
- function wpsp_get_taxonomy() {
2
  type = typeof type !== 'undefined' ? type : 'post';
3
  var response = jQuery.getJSON({
4
  type: 'POST',
@@ -32,7 +32,7 @@ function wpsp_get_terms( type ) {
32
  return response.responseJSON;
33
  }
34
 
35
- function wpsp_get_option() {
36
  key = typeof key !== 'undefined' ? key : 'wpsp_taxonomy';
37
  var response = jQuery.getJSON({
38
  type: 'POST',
1
+ function wpsp_get_taxonomy( type ) {
2
  type = typeof type !== 'undefined' ? type : 'post';
3
  var response = jQuery.getJSON({
4
  type: 'POST',
32
  return response.responseJSON;
33
  }
34
 
35
+ function wpsp_get_option( key ) {
36
  key = typeof key !== 'undefined' ? key : 'wpsp_taxonomy';
37
  var response = jQuery.getJSON({
38
  type: 'POST',
inc/functions.php CHANGED
@@ -2,6 +2,27 @@
2
  // No direct access, please
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  if ( ! function_exists( 'wpsp_meta' ) ) :
6
  /**
7
  * Build our post meta
2
  // No direct access, please
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
+ if ( ! function_exists( 'wpsp_excerpt' ) ) :
6
+ /**
7
+ * Build our excerpt
8
+ * @since 0.9
9
+ */
10
+ function wpsp_excerpt( $excerpt_length )
11
+ {
12
+ // Run our content through wp_trim_words()
13
+ $content = wp_trim_words( get_the_content(), $excerpt_length, apply_filters( 'wpsp_ellipses', '...' ) );
14
+
15
+ // Strip shortcodes from our content
16
+ $content = strip_shortcodes( $content );
17
+
18
+ // Strip URLs from our excerpt (oembeds etc..)
19
+ $content = preg_replace( '~http(s)?://[^\s]*~i', '', $content );
20
+
21
+ // Return our content
22
+ echo $content;
23
+ }
24
+ endif;
25
+
26
  if ( ! function_exists( 'wpsp_meta' ) ) :
27
  /**
28
  * Build our post meta
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://wpshowposts.com
4
  Tags: show posts, display posts shortcode, portfolio, gallery, post columns
5
  Requires at least: 4.0
6
  Tested up to: 4.6.1
7
- Stable tag: 0.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -149,6 +149,10 @@ In most cases, #1 will work fine and is way easier.
149
 
150
  == Changelog ==
151
 
 
 
 
 
152
  = 0.8 =
153
  * Strip shortcodes from excerpts
154
  * Add ellipses after excerpts
@@ -200,6 +204,10 @@ In most cases, #1 will work fine and is way easier.
200
 
201
  == Upgrade Notice ==
202
 
 
 
 
 
203
  = 0.8 =
204
  * Strip shortcodes from excerpts
205
  * Add ellipses after excerpts
4
  Tags: show posts, display posts shortcode, portfolio, gallery, post columns
5
  Requires at least: 4.0
6
  Tested up to: 4.6.1
7
+ Stable tag: 0.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
149
 
150
  == Changelog ==
151
 
152
+ = 0.9 =
153
+ * Fix bug where terms weren't saving
154
+ * Strip oembed URLs from excerpt
155
+
156
  = 0.8 =
157
  * Strip shortcodes from excerpts
158
  * Add ellipses after excerpts
204
 
205
  == Upgrade Notice ==
206
 
207
+ = 0.9 =
208
+ * Fix bug where terms weren't saving
209
+ * Strip oembed URLs from excerpt
210
+
211
  = 0.8 =
212
  * Strip shortcodes from excerpts
213
  * Add ellipses after excerpts
wp-show-posts.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Show Posts
4
  Plugin URI: https://wpshowposts.com
5
  Description: WP Show Posts allows you to list posts (from any post type) anywhere on your site. This includes WooCommerce products or any other post type you might have! Check out the pro version for even more features at https://wpshowposts.com.
6
- Version: 0.8
7
  Author: Tom Usborne
8
  Author URI: https://tomusborne.com
9
  License: GNU General Public License v2 or later
@@ -15,7 +15,7 @@ Text Domain: wp-show-posts
15
  if ( ! defined( 'ABSPATH' ) ) exit;
16
 
17
  // Define the current version
18
- define( 'WPSP_VERSION', 0.8 );
19
 
20
  // Add defaults
21
  require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/defaults.php';
@@ -347,7 +347,6 @@ function wpsp_display( $id )
347
 
348
  // Start the query
349
  $query = new WP_Query( apply_filters( 'wp_show_posts_shortcode_args', $args ) );
350
-
351
  // Start the loop
352
  if ( $query->have_posts() ) {
353
  while ( $query->have_posts() ) {
@@ -410,7 +409,7 @@ function wpsp_display( $id )
410
  // The excerpt or full content
411
  if ( 'excerpt' == $content_type && $excerpt_length && ! $more_tag && 'none' !== $content_type ) : ?>
412
  <div class="wp-show-posts-entry-summary" itemprop="text">
413
- <?php echo strip_shortcodes( wp_trim_words( get_the_content(), $excerpt_length, apply_filters( 'wpsp_ellipses', '...' ) ) ); ?>
414
  </div><!-- .entry-summary -->
415
  <?php elseif ( ( 'full' == $content_type || $more_tag ) && 'none' !== $content_type ) : ?>
416
  <div class="wp-show-posts-entry-content" itemprop="text">
3
  Plugin Name: WP Show Posts
4
  Plugin URI: https://wpshowposts.com
5
  Description: WP Show Posts allows you to list posts (from any post type) anywhere on your site. This includes WooCommerce products or any other post type you might have! Check out the pro version for even more features at https://wpshowposts.com.
6
+ Version: 0.9
7
  Author: Tom Usborne
8
  Author URI: https://tomusborne.com
9
  License: GNU General Public License v2 or later
15
  if ( ! defined( 'ABSPATH' ) ) exit;
16
 
17
  // Define the current version
18
+ define( 'WPSP_VERSION', 0.9 );
19
 
20
  // Add defaults
21
  require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/defaults.php';
347
 
348
  // Start the query
349
  $query = new WP_Query( apply_filters( 'wp_show_posts_shortcode_args', $args ) );
 
350
  // Start the loop
351
  if ( $query->have_posts() ) {
352
  while ( $query->have_posts() ) {
409
  // The excerpt or full content
410
  if ( 'excerpt' == $content_type && $excerpt_length && ! $more_tag && 'none' !== $content_type ) : ?>
411
  <div class="wp-show-posts-entry-summary" itemprop="text">
412
+ <?php wpsp_excerpt( $excerpt_length ); ?>
413
  </div><!-- .entry-summary -->
414
  <?php elseif ( ( 'full' == $content_type || $more_tag ) && 'none' !== $content_type ) : ?>
415
  <div class="wp-show-posts-entry-content" itemprop="text">