WP Show Posts - Version 0.3

Version Description

  • Remove attachment post type from list for now
  • Don't show pagination if there's no posts
  • Move wpsp_before_title hook into the
    element
  • New hook: wpsp_before_wrapper
  • New hook: wpsp_before_header
Download this release

Release Info

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

Code changes from version 0.2 to 0.3

Files changed (4) hide show
  1. admin/metabox.php +1 -1
  2. inc/functions.php +1 -1
  3. readme.txt +15 -1
  4. wp-show-posts.php +9 -6
admin/metabox.php CHANGED
@@ -54,7 +54,7 @@ function wpsp_get_post_types()
54
  $post_types = get_post_types( array( 'public' => true ) );
55
  $types = array();
56
  foreach ( $post_types as $type ) {
57
- if ( 'wp_show_posts' !== $type )
58
  $types[ $type ] = $type;
59
  }
60
 
54
  $post_types = get_post_types( array( 'public' => true ) );
55
  $types = array();
56
  foreach ( $post_types as $type ) {
57
+ if ( 'wp_show_posts' !== $type && 'attachment' !== $type )
58
  $types[ $type ] = $type;
59
  }
60
 
inc/functions.php CHANGED
@@ -215,7 +215,7 @@ function wpsp_post_image()
215
  endif;
216
 
217
  if ( ! function_exists( 'wpsp_add_post_image_before_title' ) ) :
218
- add_action( 'wpsp_before_title','wpsp_add_post_image_before_title' );
219
  function wpsp_add_post_image_before_title()
220
  {
221
  global $wpsp_id;
215
  endif;
216
 
217
  if ( ! function_exists( 'wpsp_add_post_image_before_title' ) ) :
218
+ add_action( 'wpsp_before_header','wpsp_add_post_image_before_title' );
219
  function wpsp_add_post_image_before_title()
220
  {
221
  global $wpsp_id;
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
7
- Stable tag: 0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -147,6 +147,13 @@ In most cases, #1 will work fine and is way easier.
147
 
148
  == Changelog ==
149
 
 
 
 
 
 
 
 
150
  = 0.2 =
151
  * Fix issue with posts showing up in wrong area on page
152
  * Remove read more link if the <!-- more --> tag is used
@@ -157,6 +164,13 @@ In most cases, #1 will work fine and is way easier.
157
 
158
  == Upgrade Notice ==
159
 
 
 
 
 
 
 
 
160
  = 0.2 =
161
  * Fix issue with posts showing up in wrong area on page
162
  * Remove read more link if the <!-- more --> tag is used
4
  Tags: show posts, display posts shortcode, portfolio, gallery, post columns
5
  Requires at least: 4.0
6
  Tested up to: 4.6
7
+ Stable tag: 0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
147
 
148
  == Changelog ==
149
 
150
+ = 0.3 =
151
+ * Remove attachment post type from list for now
152
+ * Don't show pagination if there's no posts
153
+ * Move wpsp_before_title hook into the <header> element
154
+ * New hook: wpsp_before_wrapper
155
+ * New hook: wpsp_before_header
156
+
157
  = 0.2 =
158
  * Fix issue with posts showing up in wrong area on page
159
  * Remove read more link if the <!-- more --> tag is used
164
 
165
  == Upgrade Notice ==
166
 
167
+ = 0.3 =
168
+ * Remove attachment post type from list for now
169
+ * Don't show pagination if there's no posts
170
+ * Move wpsp_before_title hook into the <header> element
171
+ * New hook: wpsp_before_wrapper
172
+ * New hook: wpsp_before_header
173
+
174
  = 0.2 =
175
  * Fix issue with posts showing up in wrong area on page
176
  * Remove read more link if the <!-- more --> tag is used
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.2
7
  Author: Tom Usborne
8
  Author URI: https://tomusborne.com
9
  License: GNU General Public License v2 or later
@@ -12,7 +12,7 @@ Text Domain: wp-show-posts
12
  */
13
 
14
  // Define the current version
15
- define( 'WPSP_VERSION', 0.2 );
16
 
17
  // Add defaults
18
  require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/defaults.php';
@@ -320,16 +320,21 @@ function wpsp_display( $id )
320
  $column_class .= ' ' . $columns;
321
  endif;
322
 
 
 
323
  // Start inner container
324
  echo '<' . $inner_wrapper . ' class="' . implode( ' ', $inner_wrapper_class ) . $column_class . $featured . '" itemtype="http://schema.org/' . $itemtype . '" itemscope>';
325
  echo '<div class="wp-show-posts-inner"' . $inner_wrapper_style . '>';
326
 
327
- do_action( 'wpsp_before_title' );
328
 
329
  // The title
330
  if ( $include_title || ( $include_author && 'below-title' == $author_location ) || ( $include_date && 'below-title' == $date_location ) || ( $include_terms && 'below-title' == $terms_location ) ) : ?>
331
  <header class="wp-show-posts-entry-header">
332
  <?php
 
 
 
333
  if ( $include_title )
334
  the_title( sprintf( '<h2 class="wp-show-posts-entry-title" itemprop="headline"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
335
 
@@ -357,8 +362,6 @@ function wpsp_display( $id )
357
  if ( 'col-12' == $columns ) echo '<div class="wpsp-clear"></div>';
358
  // End inner container
359
  echo '</' . $inner_wrapper . '>';
360
-
361
-
362
  }
363
  } else {
364
  // no posts found
@@ -370,7 +373,7 @@ function wpsp_display( $id )
370
  do_action( 'wpsp_after_wrapper' );
371
 
372
  // Pagination
373
- if ( $pagination ) :
374
  if ( $ajax_pagination && function_exists( 'wpsp_ajax_pagination' ) ) :
375
  $max_page = $query->max_num_pages;
376
  $nextpage = intval( $paged ) + 1;
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.3
7
  Author: Tom Usborne
8
  Author URI: https://tomusborne.com
9
  License: GNU General Public License v2 or later
12
  */
13
 
14
  // Define the current version
15
+ define( 'WPSP_VERSION', 0.3 );
16
 
17
  // Add defaults
18
  require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/defaults.php';
320
  $column_class .= ' ' . $columns;
321
  endif;
322
 
323
+ do_action( 'wpsp_before_wrapper' );
324
+
325
  // Start inner container
326
  echo '<' . $inner_wrapper . ' class="' . implode( ' ', $inner_wrapper_class ) . $column_class . $featured . '" itemtype="http://schema.org/' . $itemtype . '" itemscope>';
327
  echo '<div class="wp-show-posts-inner"' . $inner_wrapper_style . '>';
328
 
329
+ do_action( 'wpsp_before_header' );
330
 
331
  // The title
332
  if ( $include_title || ( $include_author && 'below-title' == $author_location ) || ( $include_date && 'below-title' == $date_location ) || ( $include_terms && 'below-title' == $terms_location ) ) : ?>
333
  <header class="wp-show-posts-entry-header">
334
  <?php
335
+
336
+ do_action( 'wpsp_before_title' );
337
+
338
  if ( $include_title )
339
  the_title( sprintf( '<h2 class="wp-show-posts-entry-title" itemprop="headline"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
340
 
362
  if ( 'col-12' == $columns ) echo '<div class="wpsp-clear"></div>';
363
  // End inner container
364
  echo '</' . $inner_wrapper . '>';
 
 
365
  }
366
  } else {
367
  // no posts found
373
  do_action( 'wpsp_after_wrapper' );
374
 
375
  // Pagination
376
+ if ( $pagination && $query->have_posts() ) :
377
  if ( $ajax_pagination && function_exists( 'wpsp_ajax_pagination' ) ) :
378
  $max_page = $query->max_num_pages;
379
  $nextpage = intval( $paged ) + 1;