Version Description
- Add new hook inside image container: wpsp_inside_image_container
- Fix issue with pagination and random post ordering
- Clean up defaults to only include free options
- Add margin to the top of pagination
- Use manual excerpt if it's set
Download this release
Release Info
Developer | edge22 |
Plugin | WP Show Posts |
Version | 1.0 |
Comparing to | |
See all releases |
Code changes from version 0.9 to 1.0
- css/wp-show-posts-min.css +1 -1
- css/wp-show-posts.css +8 -1
- inc/compat.php +47 -0
- inc/defaults.php +1 -21
- inc/functions.php +14 -8
- readme.txt +33 -6
- wp-show-posts.php +35 -16
css/wp-show-posts-min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
body .wp-show-posts a{box-shadow:0 0 0 transparent}.wp-show-posts-entry-title a{text-decoration:none}a.wp-show-posts-read-more,a.wp-show-posts-read-more:visited{display:inline-block;padding:8px 15px;border:2px solid #222;border-radius:3px;color:#222;font-size:0.8em;text-decoration:none}.wpsp-read-more{margin:0 0 1em;display:inline-block}a.wp-show-posts-read-more:hover,a.wp-show-posts-read-more:focus{border:2px solid transparent;color:#fff;background:#222;text-decoration:none}.wp-show-posts-image{margin-bottom:1em}.wp-show-posts-image.wpsp-image-left{float:left;margin-right:1.5em}.wp-show-posts-image.wpsp-image-right{float:right;margin-left:1.5em}.wp-show-posts-image.wpsp-image-center{display:block;text-align:center}.wp-show-posts-image img{margin:0 !important;vertical-align:bottom;height:auto}.wp-show-posts-entry-header{margin:0 0 1em;padding:0}.wp-show-posts .wp-show-posts-entry-title{font-size:30px;line-height:35px;margin:0}.wp-show-posts-updated{display:none}.wp-show-posts-entry-summary,.wp-show-posts-entry-content{margin-bottom:1em}.wp-show-posts-entry-meta{font-size:0.8em
|
1 |
+
body .wp-show-posts a{box-shadow:0 0 0 transparent}.wp-show-posts-entry-title a{text-decoration:none}a.wp-show-posts-read-more,a.wp-show-posts-read-more:visited{display:inline-block;padding:8px 15px;border:2px solid #222;border-radius:3px;color:#222;font-size:0.8em;text-decoration:none}.wpsp-read-more{margin:0 0 1em;display:inline-block}a.wp-show-posts-read-more:hover,a.wp-show-posts-read-more:focus{border:2px solid transparent;color:#fff;background:#222;text-decoration:none}.wp-show-posts-image{margin-bottom:1em}.wp-show-posts-image.wpsp-image-left{float:left;margin-right:1.5em}.wp-show-posts-image.wpsp-image-right{float:right;margin-left:1.5em}.wp-show-posts-image.wpsp-image-center{display:block;text-align:center}.wp-show-posts-image img{margin:0 !important;vertical-align:bottom;height:auto}.wp-show-posts-entry-header{margin:0 0 1em;padding:0}.wp-show-posts .wp-show-posts-entry-title{font-size:30px;line-height:35px;margin:0}.wp-show-posts-updated{display:none}.wp-show-posts-entry-summary,.wp-show-posts-entry-content{margin-bottom:1em}.wp-show-posts-entry-meta{font-size:0.8em}.wp-show-posts-separator{opacity:0.5}.wp-show-posts-meta a,.wp-show-posts-meta a:visited{color:rgba( 0,0,0,0.5 )}.stack-wp-show-posts-byline,.stack-wp-show-posts-posted-on{display:block}.wp-show-posts-entry-meta-below-post{margin-bottom:1em}.wp-show-posts-columns:not(.wp-show-posts-masonry){display:flex;flex-wrap:wrap}.wp-show-posts-columns .wp-show-posts-single:not(.wp-show-posts-masonry-block){display:flex;flex-direction:row}.wp-show-posts-columns .wp-show-posts-single:not(.wp-show-posts-masonry-block) .wp-show-posts-image img{flex:0 0 auto;object-fit:scale-down}.wpsp-clear{clear:both;display:block;overflow:hidden;visibility:hidden;width:0;height:0}.wp-show-posts:not(.wp-show-posts-columns) .wp-show-posts-single:not(:last-child){margin-bottom:2em}.wpsp-load-more{margin-top:2em}.wp-show-posts-columns .wp-show-posts-entry-title{font-size:25px}.wp-show-posts-columns .wp-show-posts-single.col-md-4 .wp-show-posts-entry-title,.wp-show-posts-columns .wp-show-posts-single.col-md-3 .wp-show-posts-entry-title,.wp-show-posts-columns .wp-show-posts-single.col-md-20 .wp-show-posts-entry-title{font-size:20px}.wp-show-posts-columns .wp-show-posts-inner{flex:1}@media (min-width: 768px){.wpsp-col-1,.wpsp-col-2,.wpsp-col-3,.wpsp-col-4,.wpsp-col-5,.wpsp-col-6,.wpsp-col-7,.wpsp-col-8,.wpsp-col-9,.wpsp-col-10,.wpsp-col-11,.wpsp-col-12,.wpsp-col-20{float:left}.wpsp-col-1{width:8.333333%}.wpsp-col-2{width:16.666667%}.wpsp-col-3{width:25%}.wpsp-col-4{width:33.333%}.wpsp-col-5{width:41.666667%}.wpsp-col-6{width:50%}.wpsp-col-7{width:58.333333%}.wpsp-col-8{width:66.666667%}.wpsp-col-9{width:75%}.wpsp-col-10{width:83.333333%}.wpsp-col-11{width:91.666667%}.wpsp-col-12{width:100%}.wpsp-col-20{width:20%}}@media (max-width: 767px){.wp-show-posts-columns,.wp-show-posts-inner{margin-left:0 !important;margin-right:0 !important}.wp-show-posts-columns .wp-show-posts-single{display:block;width:100%}}.wp-show-posts-inner *:last-child{margin-bottom:0}.screen-reader-text{clip:rect(1px, 1px, 1px, 1px);position:absolute !important}.screen-reader-text:hover,.screen-reader-text:active,.screen-reader-text:focus{background-color:#f1f1f1;border-radius:3px;box-shadow:0 0 2px 2px rgba(0, 0, 0, 0.6);clip:auto !important;color:#21759b;display:block;font-size:14px;font-weight:bold;height:auto;left:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}.wpsp-clearfix:after{content:".";display:block;overflow:hidden;visibility:hidden;font-size:0;line-height:0;width:0;height:0}
|
css/wp-show-posts.css
CHANGED
@@ -77,7 +77,10 @@ a.wp-show-posts-read-more:focus {
|
|
77 |
|
78 |
.wp-show-posts-entry-meta {
|
79 |
font-size: 0.8em;
|
80 |
-
|
|
|
|
|
|
|
81 |
}
|
82 |
|
83 |
.wp-show-posts-meta a,
|
@@ -121,6 +124,10 @@ a.wp-show-posts-read-more:focus {
|
|
121 |
margin-bottom: 2em;
|
122 |
}
|
123 |
|
|
|
|
|
|
|
|
|
124 |
.wp-show-posts-columns .wp-show-posts-entry-title {
|
125 |
font-size: 25px;
|
126 |
}
|
77 |
|
78 |
.wp-show-posts-entry-meta {
|
79 |
font-size: 0.8em;
|
80 |
+
}
|
81 |
+
|
82 |
+
.wp-show-posts-separator {
|
83 |
+
opacity: 0.5;
|
84 |
}
|
85 |
|
86 |
.wp-show-posts-meta a,
|
124 |
margin-bottom: 2em;
|
125 |
}
|
126 |
|
127 |
+
.wpsp-load-more {
|
128 |
+
margin-top: 2em;
|
129 |
+
}
|
130 |
+
|
131 |
.wp-show-posts-columns .wp-show-posts-entry-title {
|
132 |
font-size: 25px;
|
133 |
}
|
inc/compat.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// No direct access, please
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
+
|
5 |
+
if ( ! function_exists( 'wpsp_pro_defaults' ) ) :
|
6 |
+
/**
|
7 |
+
* Set all of our pro defaults
|
8 |
+
* This will only run if wpsp_pro_defaults() doesn't exist
|
9 |
+
* WPSP Pro 0.5 and above won't need this
|
10 |
+
*/
|
11 |
+
add_filter( 'wpsp_defaults','wpsp_pro_compat_defaults' );
|
12 |
+
function wpsp_pro_compat_defaults( $defaults )
|
13 |
+
{
|
14 |
+
$defaults[ 'wpsp_image_lightbox' ] = false;
|
15 |
+
$defaults[ 'wpsp_image_gallery' ] = false;
|
16 |
+
$defaults[ 'wpsp_image_overlay_color' ] = '';
|
17 |
+
$defaults[ 'wpsp_image_overlay_icon' ] = '';
|
18 |
+
$defaults[ 'wpsp_ajax_pagination' ] = false;
|
19 |
+
$defaults[ 'wpsp_masonry' ] = false;
|
20 |
+
$defaults[ 'wpsp_social_sharing' ] = false;
|
21 |
+
$defaults[ 'wpsp_social_sharing_alignment' ] = 'right';
|
22 |
+
$defaults[ 'wpsp_twitter' ] = false;
|
23 |
+
$defaults[ 'wpsp_facebook' ] = false;
|
24 |
+
$defaults[ 'wpsp_googleplus' ] = false;
|
25 |
+
$defaults[ 'wpsp_pinterest' ] = false;
|
26 |
+
$defaults[ 'wpsp_love' ] = false;
|
27 |
+
$defaults[ 'wpsp_featured_post' ] = false;
|
28 |
+
$defaults[ 'wpsp_image_hover_effect' ] = '';
|
29 |
+
$defaults[ 'wpsp_read_more_style' ] = 'hollow';
|
30 |
+
$defaults[ 'wpsp_read_more_color' ] = 'black';
|
31 |
+
$defaults[ 'wpsp_border' ] = '';
|
32 |
+
$defaults[ 'wpsp_border_hover' ] = '';
|
33 |
+
$defaults[ 'wpsp_filter' ] = false;
|
34 |
+
$defaults[ 'wpsp_background' ] = '';
|
35 |
+
$defaults[ 'wpsp_background_hover' ] = '';
|
36 |
+
$defaults[ 'wpsp_title_color' ] = '';
|
37 |
+
$defaults[ 'wpsp_title_color_hover' ] = '';
|
38 |
+
$defaults[ 'wpsp_meta_color' ] = '';
|
39 |
+
$defaults[ 'wpsp_meta_color_hover' ] = '';
|
40 |
+
$defaults[ 'wpsp_text' ] = '';
|
41 |
+
$defaults[ 'wpsp_link' ] = '';
|
42 |
+
$defaults[ 'wpsp_link_hover' ] = '';
|
43 |
+
$defaults[ 'wpsp_padding' ] = '';
|
44 |
+
|
45 |
+
return $defaults;
|
46 |
+
}
|
47 |
+
endif;
|
inc/defaults.php
CHANGED
@@ -25,10 +25,6 @@ function wpsp_get_defaults()
|
|
25 |
'wpsp_image_alignment' => 'center',
|
26 |
'wpsp_image_height' => '',
|
27 |
'wpsp_image_location' => 'below-title',
|
28 |
-
'wpsp_image_lightbox' => false,
|
29 |
-
'wpsp_image_gallery' => false,
|
30 |
-
'wpsp_image_overlay_color' => '',
|
31 |
-
'wpsp_image_overlay_icon' => '',
|
32 |
'wpsp_image_width' => '',
|
33 |
'wpsp_include_title' => true,
|
34 |
'wpsp_include_terms' => false,
|
@@ -58,23 +54,7 @@ function wpsp_get_defaults()
|
|
58 |
'wpsp_wrapper_class' => '',
|
59 |
'wpsp_wrapper_id' => false,
|
60 |
'wpsp_wrapper_style' => '',
|
61 |
-
'wpsp_no_results' => __( 'Sorry, no posts were found.','wp-show-posts' )
|
62 |
-
'wpsp_ajax_pagination' => false,
|
63 |
-
'wpsp_masonry' => false,
|
64 |
-
'wpsp_social_sharing' => false,
|
65 |
-
'wpsp_social_sharing_alignment' => 'right',
|
66 |
-
'wpsp_twitter' => false,
|
67 |
-
'wpsp_facebook' => false,
|
68 |
-
'wpsp_googleplus' => false,
|
69 |
-
'wpsp_pinterest' => false,
|
70 |
-
'wpsp_love' => false,
|
71 |
-
'wpsp_featured_post' => false,
|
72 |
-
'wpsp_image_hover_effect' => '',
|
73 |
-
'wpsp_read_more_style' => 'hollow',
|
74 |
-
'wpsp_read_more_color' => 'black',
|
75 |
-
'wpsp_border' => '',
|
76 |
-
'wpsp_padding' => '',
|
77 |
-
'wpsp_filter' => false
|
78 |
);
|
79 |
|
80 |
return apply_filters( 'wpsp_defaults', $defaults );
|
25 |
'wpsp_image_alignment' => 'center',
|
26 |
'wpsp_image_height' => '',
|
27 |
'wpsp_image_location' => 'below-title',
|
|
|
|
|
|
|
|
|
28 |
'wpsp_image_width' => '',
|
29 |
'wpsp_include_title' => true,
|
30 |
'wpsp_include_terms' => false,
|
54 |
'wpsp_wrapper_class' => '',
|
55 |
'wpsp_wrapper_id' => false,
|
56 |
'wpsp_wrapper_style' => '',
|
57 |
+
'wpsp_no_results' => __( 'Sorry, no posts were found.','wp-show-posts' )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
);
|
59 |
|
60 |
return apply_filters( 'wpsp_defaults', $defaults );
|
inc/functions.php
CHANGED
@@ -8,7 +8,9 @@ if ( ! function_exists( 'wpsp_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 |
|
@@ -18,6 +20,11 @@ function wpsp_excerpt( $excerpt_length )
|
|
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 |
}
|
@@ -174,7 +181,10 @@ function wpsp_post_image()
|
|
174 |
$hover = ( '' !== $image_hover_effect ) ? $image_hover_effect : '';
|
175 |
?>
|
176 |
<div class="wp-show-posts-image <?php echo $hover . ' wpsp-image-' . $image_alignment; ?> ">
|
177 |
-
<?php
|
|
|
|
|
|
|
178 |
apply_filters( 'wpsp_image_href', esc_url( get_the_permalink() ) ),
|
179 |
apply_filters( 'wpsp_image_data', '' ),
|
180 |
apply_filters( 'wpsp_image_title', esc_attr( get_the_title() ) )
|
@@ -239,13 +249,11 @@ function wpsp_read_more()
|
|
239 |
return;
|
240 |
|
241 |
$read_more_text = wp_kses_post( wpsp_get_setting( $wpsp_id, 'wpsp_read_more_text' ) );
|
242 |
-
$read_more_style = esc_attr( wpsp_get_setting( $wpsp_id, 'wpsp_read_more_style' ) );
|
243 |
-
$read_more_color = sanitize_text_field( wpsp_get_setting( $wpsp_id, 'wpsp_read_more_color' ) );
|
244 |
|
245 |
// The read more button
|
246 |
if ( $read_more_text ) : ?>
|
247 |
<div class="wpsp-read-more">
|
248 |
-
<a title="<?php echo esc_attr( get_the_title() ); ?>" class="wp-show-posts-read-more
|
249 |
</div>
|
250 |
<?php endif;
|
251 |
}
|
@@ -395,9 +403,7 @@ function wpsp_pagination( $max_num_pages ) {
|
|
395 |
) );
|
396 |
|
397 |
if ( $links ) :
|
398 |
-
|
399 |
-
echo $links;
|
400 |
-
|
401 |
endif;
|
402 |
}
|
403 |
endif;
|
8 |
* @since 0.9
|
9 |
*/
|
10 |
function wpsp_excerpt( $excerpt_length )
|
11 |
+
{
|
12 |
+
global $post;
|
13 |
+
|
14 |
// Run our content through wp_trim_words()
|
15 |
$content = wp_trim_words( get_the_content(), $excerpt_length, apply_filters( 'wpsp_ellipses', '...' ) );
|
16 |
|
20 |
// Strip URLs from our excerpt (oembeds etc..)
|
21 |
$content = preg_replace( '~http(s)?://[^\s]*~i', '', $content );
|
22 |
|
23 |
+
// If we have a manual excerpt, use it instead
|
24 |
+
if ( '' !== $post->post_excerpt ) {
|
25 |
+
$content = $post->post_excerpt;
|
26 |
+
}
|
27 |
+
|
28 |
// Return our content
|
29 |
echo $content;
|
30 |
}
|
181 |
$hover = ( '' !== $image_hover_effect ) ? $image_hover_effect : '';
|
182 |
?>
|
183 |
<div class="wp-show-posts-image <?php echo $hover . ' wpsp-image-' . $image_alignment; ?> ">
|
184 |
+
<?php
|
185 |
+
do_action( 'wpsp_inside_image_container' );
|
186 |
+
|
187 |
+
printf( '<a href="%1$s" %2$s title="%3$s">',
|
188 |
apply_filters( 'wpsp_image_href', esc_url( get_the_permalink() ) ),
|
189 |
apply_filters( 'wpsp_image_data', '' ),
|
190 |
apply_filters( 'wpsp_image_title', esc_attr( get_the_title() ) )
|
249 |
return;
|
250 |
|
251 |
$read_more_text = wp_kses_post( wpsp_get_setting( $wpsp_id, 'wpsp_read_more_text' ) );
|
|
|
|
|
252 |
|
253 |
// The read more button
|
254 |
if ( $read_more_text ) : ?>
|
255 |
<div class="wpsp-read-more">
|
256 |
+
<a title="<?php echo esc_attr( get_the_title() ); ?>" class="wp-show-posts-read-more" href="<?php esc_url( the_permalink() ); ?>"><?php echo $read_more_text; ?></a>
|
257 |
</div>
|
258 |
<?php endif;
|
259 |
}
|
403 |
) );
|
404 |
|
405 |
if ( $links ) :
|
406 |
+
echo '<div class="wpsp-load-more">' . $links . '</div>';
|
|
|
|
|
407 |
endif;
|
408 |
}
|
409 |
endif;
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: edge22
|
|
3 |
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.
|
7 |
-
Stable tag: 0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -21,7 +21,7 @@ You can pull posts from any post type like WooCommerce, Easy Digital Downloads e
|
|
21 |
This plugin works with any theme.
|
22 |
|
23 |
Here are the features in the free version:
|
24 |
-
|
25 |
= Posts =
|
26 |
|
27 |
* Post type
|
@@ -89,6 +89,10 @@ https://vimeo.com/175660953
|
|
89 |
|
90 |
* Masonry
|
91 |
* Featured post
|
|
|
|
|
|
|
|
|
92 |
|
93 |
= Images =
|
94 |
|
@@ -102,18 +106,27 @@ https://vimeo.com/175660953
|
|
102 |
|
103 |
* Read more style
|
104 |
* Read more color
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
-
=
|
107 |
|
108 |
-
*
|
109 |
-
*
|
110 |
|
111 |
= Social =
|
112 |
|
113 |
* Twitter
|
|
|
114 |
* Facebook
|
|
|
115 |
* Google+
|
|
|
116 |
* Pinterest
|
|
|
117 |
* Love it
|
118 |
* Alignment
|
119 |
|
@@ -149,6 +162,13 @@ In most cases, #1 will work fine and is way easier.
|
|
149 |
|
150 |
== Changelog ==
|
151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
= 0.9 =
|
153 |
* Fix bug where terms weren't saving
|
154 |
* Strip oembed URLs from excerpt
|
@@ -204,6 +224,13 @@ In most cases, #1 will work fine and is way easier.
|
|
204 |
|
205 |
== Upgrade Notice ==
|
206 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
= 0.9 =
|
208 |
* Fix bug where terms weren't saving
|
209 |
* Strip oembed URLs from excerpt
|
3 |
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.7
|
7 |
+
Stable tag: 1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
21 |
This plugin works with any theme.
|
22 |
|
23 |
Here are the features in the free version:
|
24 |
+
|
25 |
= Posts =
|
26 |
|
27 |
* Post type
|
89 |
|
90 |
* Masonry
|
91 |
* Featured post
|
92 |
+
* Background color
|
93 |
+
* Background color hover
|
94 |
+
* Border color
|
95 |
+
* Border color hover
|
96 |
|
97 |
= Images =
|
98 |
|
106 |
|
107 |
* Read more style
|
108 |
* Read more color
|
109 |
+
* Content link color
|
110 |
+
* Content link color hover
|
111 |
+
* Content text color
|
112 |
+
* Title color
|
113 |
+
* Title color hover
|
114 |
|
115 |
+
= Meta =
|
116 |
|
117 |
+
* Meta color
|
118 |
+
* Meta color hover
|
119 |
|
120 |
= Social =
|
121 |
|
122 |
* Twitter
|
123 |
+
* Twitter color + hover
|
124 |
* Facebook
|
125 |
+
* Facebook color + hover
|
126 |
* Google+
|
127 |
+
* Google+ color + hover
|
128 |
* Pinterest
|
129 |
+
* Pinterest color + hover
|
130 |
* Love it
|
131 |
* Alignment
|
132 |
|
162 |
|
163 |
== Changelog ==
|
164 |
|
165 |
+
= 1.0 =
|
166 |
+
* Add new hook inside image container: wpsp_inside_image_container
|
167 |
+
* Fix issue with pagination and random post ordering
|
168 |
+
* Clean up defaults to only include free options
|
169 |
+
* Add margin to the top of pagination
|
170 |
+
* Use manual excerpt if it's set
|
171 |
+
|
172 |
= 0.9 =
|
173 |
* Fix bug where terms weren't saving
|
174 |
* Strip oembed URLs from excerpt
|
224 |
|
225 |
== Upgrade Notice ==
|
226 |
|
227 |
+
= 1.0 =
|
228 |
+
* Add new hook inside image container: wpsp_inside_image_container
|
229 |
+
* Fix issue with pagination and random post ordering
|
230 |
+
* Clean up defaults to only include free options
|
231 |
+
* Add margin to the top of pagination
|
232 |
+
* Use manual excerpt if it's set
|
233 |
+
|
234 |
= 0.9 =
|
235 |
* Fix bug where terms weren't saving
|
236 |
* Strip oembed URLs from excerpt
|
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
|
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
|
19 |
|
20 |
// Add defaults
|
21 |
require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/defaults.php';
|
@@ -41,6 +41,9 @@ require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'admin/admin.php';
|
|
41 |
// Add widget
|
42 |
require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'admin/widget.php';
|
43 |
|
|
|
|
|
|
|
44 |
if ( ! function_exists( 'wpsp_load_textdomain' ) ) :
|
45 |
/**
|
46 |
* Load plugin textdomain.
|
@@ -85,7 +88,14 @@ if ( ! function_exists( 'wpsp_get_setting' ) ) :
|
|
85 |
*/
|
86 |
function wpsp_get_setting( $id, $key )
|
87 |
{
|
|
|
88 |
$defaults = wpsp_get_defaults();
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
return get_post_meta( $id, $key ) ? get_post_meta( $id, $key, true ) : $defaults[ $key ];
|
90 |
}
|
91 |
endif;
|
@@ -112,8 +122,6 @@ function wpsp_display( $id )
|
|
112 |
$post_id = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_post_id' ) );
|
113 |
$exclude_post_id = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_exclude_post_id' ) );
|
114 |
$ignore_sticky_posts = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_ignore_sticky_posts' ) );
|
115 |
-
$image_gallery = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_image_gallery' ) );
|
116 |
-
$image_lightbox = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_image_lightbox' ) );
|
117 |
$include_title = wp_validate_boolean( get_post_meta( $id, 'wpsp_include_title', true ) );
|
118 |
$author_location = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_author_location' ) );
|
119 |
$date_location = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_date_location' ) );
|
@@ -138,16 +146,9 @@ function wpsp_display( $id )
|
|
138 |
$tax_term = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_tax_term' ) );
|
139 |
$taxonomy = sanitize_key( wpsp_get_setting( $id, 'wpsp_taxonomy' ) );
|
140 |
$wrapper = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_wrapper' ) );
|
141 |
-
$wrapper_id = sanitize_html_class( wpsp_get_setting( $id, 'wpsp_wrapper_id' ) );
|
142 |
$wrapper_class = array_map( 'sanitize_html_class', ( explode( ' ', wpsp_get_setting( $id, 'wpsp_wrapper_class' ) ) ) );
|
143 |
$wrapper_style = explode( ' ', esc_attr( wpsp_get_setting( $id, 'wpsp_wrapper_style' ) ) );
|
144 |
$no_results = wp_kses_post( wpsp_get_setting( $id, 'wpsp_no_results' ) );
|
145 |
-
$ajax_pagination = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_ajax_pagination' ) );
|
146 |
-
$masonry = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_masonry' ) );
|
147 |
-
$featured_post = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_featured_post' ) );
|
148 |
-
$border = wpsp_sanitize_hex_color( wpsp_get_setting( $id, 'wpsp_border' ) );
|
149 |
-
$padding = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_padding' ) );
|
150 |
-
$filter = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_filter' ) );
|
151 |
|
152 |
// Grab initiate args for query
|
153 |
$args = array();
|
@@ -158,6 +159,10 @@ function wpsp_display( $id )
|
|
158 |
if ( '' !== $orderby )
|
159 |
$args[ 'orderby' ] = $orderby;
|
160 |
|
|
|
|
|
|
|
|
|
161 |
if ( '' !== $post_type )
|
162 |
$args[ 'post_type' ] = $post_type;
|
163 |
|
@@ -246,12 +251,16 @@ function wpsp_display( $id )
|
|
246 |
$args['post__not_in'] = array( get_the_ID() );
|
247 |
|
248 |
// Border
|
|
|
249 |
if ( '' !== $border ) {
|
250 |
$wrapper_class[] = 'include-border';
|
251 |
-
|
|
|
|
|
252 |
}
|
253 |
|
254 |
// Padding
|
|
|
255 |
if ( '' !== $padding ) {
|
256 |
$wrapper_class[] = 'include-padding';
|
257 |
$padding = 'padding:' . $padding . ';';
|
@@ -261,11 +270,15 @@ function wpsp_display( $id )
|
|
261 |
if ( $columns !== 'col-12' ) :
|
262 |
wp_enqueue_script( 'wpsp-matchHeight', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'js/jquery.matchHeight.js', array( 'jquery' ), WPSP_VERSION, true );
|
263 |
$wrapper_class[] = 'wp-show-posts-columns';
|
264 |
-
|
265 |
-
|
|
|
|
|
266 |
endif;
|
267 |
|
268 |
// Featured post class
|
|
|
|
|
269 |
$current_post = '';
|
270 |
if ( $columns !== 'col-12' && $featured_post ) :
|
271 |
if ( $columns == 'col-6' )
|
@@ -282,6 +295,8 @@ function wpsp_display( $id )
|
|
282 |
endif;
|
283 |
|
284 |
// Masonry
|
|
|
|
|
285 |
if ( $masonry ) :
|
286 |
$wrapper_class[] = 'wp-show-posts-masonry';
|
287 |
$inner_wrapper_class[] = ' wp-show-posts-masonry-' . $columns;
|
@@ -293,6 +308,7 @@ function wpsp_display( $id )
|
|
293 |
endif;
|
294 |
|
295 |
// Filter
|
|
|
296 |
// if ( $filter ) :
|
297 |
// wp_enqueue_script( 'wpsp-imagesloaded' );
|
298 |
// wp_enqueue_script( 'wpsp-filterizr' );
|
@@ -323,8 +339,7 @@ function wpsp_display( $id )
|
|
323 |
$inner_wrapper_style = ' style="' . implode( ' ', $inner_wrapper_style ) . '"';
|
324 |
|
325 |
// Get the wrapper ID
|
326 |
-
|
327 |
-
$wrapper_id = ' id="' . $wrapper_id . '"';
|
328 |
|
329 |
$wrapper_atts = apply_filters( 'wpsp_wrapper_atts', '' );
|
330 |
|
@@ -437,6 +452,8 @@ function wpsp_display( $id )
|
|
437 |
|
438 |
// Pagination
|
439 |
if ( $pagination && $query->have_posts() && ! is_single() ) :
|
|
|
|
|
440 |
if ( $ajax_pagination && function_exists( 'wpsp_ajax_pagination' ) ) :
|
441 |
|
442 |
$max_page = $query->max_num_pages;
|
@@ -454,10 +471,12 @@ function wpsp_display( $id )
|
|
454 |
endif;
|
455 |
|
456 |
// Lightbox and gallery
|
|
|
457 |
if ( $image_lightbox ) {
|
458 |
wp_enqueue_script( 'wpsp-featherlight' );
|
459 |
wp_enqueue_style( 'wpsp-featherlight' );
|
460 |
|
|
|
461 |
if ( $image_gallery ) {
|
462 |
wp_enqueue_script( 'wpsp-featherlight-gallery' );
|
463 |
wp_enqueue_style( 'wpsp-featherlight-gallery' );
|
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: 1.0
|
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', 1.0 );
|
19 |
|
20 |
// Add defaults
|
21 |
require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/defaults.php';
|
41 |
// Add widget
|
42 |
require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'admin/widget.php';
|
43 |
|
44 |
+
// Add compatibility with pro
|
45 |
+
require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/compat.php';
|
46 |
+
|
47 |
if ( ! function_exists( 'wpsp_load_textdomain' ) ) :
|
48 |
/**
|
49 |
* Load plugin textdomain.
|
88 |
*/
|
89 |
function wpsp_get_setting( $id, $key )
|
90 |
{
|
91 |
+
// Get our defaults
|
92 |
$defaults = wpsp_get_defaults();
|
93 |
+
|
94 |
+
// Bail if our default isn't set
|
95 |
+
if ( ! isset( $defaults[ $key ] ) )
|
96 |
+
return false;
|
97 |
+
|
98 |
+
// If we have a default, let's return a value
|
99 |
return get_post_meta( $id, $key ) ? get_post_meta( $id, $key, true ) : $defaults[ $key ];
|
100 |
}
|
101 |
endif;
|
122 |
$post_id = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_post_id' ) );
|
123 |
$exclude_post_id = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_exclude_post_id' ) );
|
124 |
$ignore_sticky_posts = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_ignore_sticky_posts' ) );
|
|
|
|
|
125 |
$include_title = wp_validate_boolean( get_post_meta( $id, 'wpsp_include_title', true ) );
|
126 |
$author_location = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_author_location' ) );
|
127 |
$date_location = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_date_location' ) );
|
146 |
$tax_term = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_tax_term' ) );
|
147 |
$taxonomy = sanitize_key( wpsp_get_setting( $id, 'wpsp_taxonomy' ) );
|
148 |
$wrapper = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_wrapper' ) );
|
|
|
149 |
$wrapper_class = array_map( 'sanitize_html_class', ( explode( ' ', wpsp_get_setting( $id, 'wpsp_wrapper_class' ) ) ) );
|
150 |
$wrapper_style = explode( ' ', esc_attr( wpsp_get_setting( $id, 'wpsp_wrapper_style' ) ) );
|
151 |
$no_results = wp_kses_post( wpsp_get_setting( $id, 'wpsp_no_results' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
// Grab initiate args for query
|
154 |
$args = array();
|
159 |
if ( '' !== $orderby )
|
160 |
$args[ 'orderby' ] = $orderby;
|
161 |
|
162 |
+
if ( 'rand' == $orderby && $pagination ) {
|
163 |
+
$args[ 'orderby' ] = 'rand(' . $id . ')';
|
164 |
+
}
|
165 |
+
|
166 |
if ( '' !== $post_type )
|
167 |
$args[ 'post_type' ] = $post_type;
|
168 |
|
251 |
$args['post__not_in'] = array( get_the_ID() );
|
252 |
|
253 |
// Border
|
254 |
+
$border = wpsp_sanitize_hex_color( wpsp_get_setting( $id, 'wpsp_border' ) );
|
255 |
if ( '' !== $border ) {
|
256 |
$wrapper_class[] = 'include-border';
|
257 |
+
if ( ! function_exists( 'wpsp_styling' ) ) :
|
258 |
+
$border = 'border-color: ' . $border . ';';
|
259 |
+
endif;
|
260 |
}
|
261 |
|
262 |
// Padding
|
263 |
+
$padding = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_padding' ) );
|
264 |
if ( '' !== $padding ) {
|
265 |
$wrapper_class[] = 'include-padding';
|
266 |
$padding = 'padding:' . $padding . ';';
|
270 |
if ( $columns !== 'col-12' ) :
|
271 |
wp_enqueue_script( 'wpsp-matchHeight', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'js/jquery.matchHeight.js', array( 'jquery' ), WPSP_VERSION, true );
|
272 |
$wrapper_class[] = 'wp-show-posts-columns';
|
273 |
+
if ( ! function_exists( 'wpsp_styling' ) ) :
|
274 |
+
$wrapper_style[] = 'margin-left:-' . $columns_gutter . ';';
|
275 |
+
$inner_wrapper_style[] = 'margin: 0 0 ' . $columns_gutter . ' ' . $columns_gutter . ';' . $padding;
|
276 |
+
endif;
|
277 |
endif;
|
278 |
|
279 |
// Featured post class
|
280 |
+
$featured_post = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_featured_post' ) );
|
281 |
+
|
282 |
$current_post = '';
|
283 |
if ( $columns !== 'col-12' && $featured_post ) :
|
284 |
if ( $columns == 'col-6' )
|
295 |
endif;
|
296 |
|
297 |
// Masonry
|
298 |
+
$masonry = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_masonry' ) );
|
299 |
+
|
300 |
if ( $masonry ) :
|
301 |
$wrapper_class[] = 'wp-show-posts-masonry';
|
302 |
$inner_wrapper_class[] = ' wp-show-posts-masonry-' . $columns;
|
308 |
endif;
|
309 |
|
310 |
// Filter
|
311 |
+
// $filter = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_filter' ) );
|
312 |
// if ( $filter ) :
|
313 |
// wp_enqueue_script( 'wpsp-imagesloaded' );
|
314 |
// wp_enqueue_script( 'wpsp-filterizr' );
|
339 |
$inner_wrapper_style = ' style="' . implode( ' ', $inner_wrapper_style ) . '"';
|
340 |
|
341 |
// Get the wrapper ID
|
342 |
+
$wrapper_id = ' id="wpsp-' . $id . '"';
|
|
|
343 |
|
344 |
$wrapper_atts = apply_filters( 'wpsp_wrapper_atts', '' );
|
345 |
|
452 |
|
453 |
// Pagination
|
454 |
if ( $pagination && $query->have_posts() && ! is_single() ) :
|
455 |
+
$ajax_pagination = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_ajax_pagination' ) );
|
456 |
+
|
457 |
if ( $ajax_pagination && function_exists( 'wpsp_ajax_pagination' ) ) :
|
458 |
|
459 |
$max_page = $query->max_num_pages;
|
471 |
endif;
|
472 |
|
473 |
// Lightbox and gallery
|
474 |
+
$image_lightbox = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_image_lightbox' ) );
|
475 |
if ( $image_lightbox ) {
|
476 |
wp_enqueue_script( 'wpsp-featherlight' );
|
477 |
wp_enqueue_style( 'wpsp-featherlight' );
|
478 |
|
479 |
+
$image_gallery = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_image_gallery' ) );
|
480 |
if ( $image_gallery ) {
|
481 |
wp_enqueue_script( 'wpsp-featherlight-gallery' );
|
482 |
wp_enqueue_style( 'wpsp-featherlight-gallery' );
|