Version Description
- Add height: auto to images to prevent image stretching in Beaver Builder
- Prevent horizontal scrolling when posts are in columns
- Change "More query args" section name to "More settings"
- Allow multiple IDs in "Post ID" option
- Add "Exclude IDs" option
- Add "No results message" option
- Add "WP Show Posts" widget to add posts in widget areas
Download this release
Release Info
Developer | edge22 |
Plugin | WP Show Posts |
Version | 0.6 |
Comparing to | |
See all releases |
Code changes from version 0.5 to 0.6
- admin/metabox.php +38 -4
- admin/widget.php +100 -0
- css/wp-show-posts-min.css +1 -1
- css/wp-show-posts.css +9 -0
- inc/defaults.php +2 -0
- readme.txt +22 -2
- wp-show-posts.php +21 -6
admin/metabox.php
CHANGED
@@ -576,7 +576,7 @@ function wpsp_register( $butterbean, $post_type ) {
|
|
576 |
$manager->register_section(
|
577 |
'wpsp_query_args',
|
578 |
array(
|
579 |
-
'label' => esc_html__( 'More
|
580 |
'icon' => 'dashicons-admin-generic',
|
581 |
'priority' => 999
|
582 |
)
|
@@ -620,20 +620,37 @@ function wpsp_register( $butterbean, $post_type ) {
|
|
620 |
$manager->register_control(
|
621 |
'wpsp_post_id', // Same as setting name.
|
622 |
array(
|
623 |
-
'type' => '
|
624 |
'section' => 'wpsp_query_args',
|
625 |
-
'label' => esc_html__( 'Post
|
626 |
)
|
627 |
);
|
628 |
|
629 |
$manager->register_setting(
|
630 |
'wpsp_post_id', // Same as control name.
|
631 |
array(
|
632 |
-
'sanitize_callback' => '
|
633 |
'default' => $defaults[ 'wpsp_post_id' ] ? $defaults[ 'wpsp_post_id' ] : ''
|
634 |
)
|
635 |
);
|
636 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
637 |
$manager->register_control(
|
638 |
'wpsp_ignore_sticky_posts',
|
639 |
array(
|
@@ -809,6 +826,23 @@ function wpsp_register( $butterbean, $post_type ) {
|
|
809 |
'default' => $defaults[ 'wpsp_tax_operator' ] ? $defaults[ 'wpsp_tax_operator' ] : 'IN'
|
810 |
)
|
811 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
812 |
}
|
813 |
endif;
|
814 |
|
576 |
$manager->register_section(
|
577 |
'wpsp_query_args',
|
578 |
array(
|
579 |
+
'label' => esc_html__( 'More settings', 'wp-show-posts' ),
|
580 |
'icon' => 'dashicons-admin-generic',
|
581 |
'priority' => 999
|
582 |
)
|
620 |
$manager->register_control(
|
621 |
'wpsp_post_id', // Same as setting name.
|
622 |
array(
|
623 |
+
'type' => 'text',
|
624 |
'section' => 'wpsp_query_args',
|
625 |
+
'label' => esc_html__( 'Post IDs', 'wp-show-posts' )
|
626 |
)
|
627 |
);
|
628 |
|
629 |
$manager->register_setting(
|
630 |
'wpsp_post_id', // Same as control name.
|
631 |
array(
|
632 |
+
'sanitize_callback' => 'sanitize_text_field',
|
633 |
'default' => $defaults[ 'wpsp_post_id' ] ? $defaults[ 'wpsp_post_id' ] : ''
|
634 |
)
|
635 |
);
|
636 |
|
637 |
+
$manager->register_control(
|
638 |
+
'wpsp_exclude_post_id', // Same as setting name.
|
639 |
+
array(
|
640 |
+
'type' => 'text',
|
641 |
+
'section' => 'wpsp_query_args',
|
642 |
+
'label' => esc_html__( 'Exclude Post IDs', 'wp-show-posts' )
|
643 |
+
)
|
644 |
+
);
|
645 |
+
|
646 |
+
$manager->register_setting(
|
647 |
+
'wpsp_exclude_post_id', // Same as control name.
|
648 |
+
array(
|
649 |
+
'sanitize_callback' => 'sanitize_text_field',
|
650 |
+
'default' => $defaults[ 'wpsp_exclude_post_id' ] ? $defaults[ 'wpsp_exclude_post_id' ] : ''
|
651 |
+
)
|
652 |
+
);
|
653 |
+
|
654 |
$manager->register_control(
|
655 |
'wpsp_ignore_sticky_posts',
|
656 |
array(
|
826 |
'default' => $defaults[ 'wpsp_tax_operator' ] ? $defaults[ 'wpsp_tax_operator' ] : 'IN'
|
827 |
)
|
828 |
);
|
829 |
+
|
830 |
+
$manager->register_control(
|
831 |
+
'wpsp_no_results', // Same as setting name.
|
832 |
+
array(
|
833 |
+
'type' => 'text',
|
834 |
+
'section' => 'wpsp_query_args',
|
835 |
+
'label' => esc_html__( 'No results message', 'wp-show-posts' )
|
836 |
+
)
|
837 |
+
);
|
838 |
+
|
839 |
+
$manager->register_setting(
|
840 |
+
'wpsp_no_results', // Same as control name.
|
841 |
+
array(
|
842 |
+
'sanitize_callback' => 'wp_kses_post',
|
843 |
+
'default' => $defaults[ 'wpsp_no_results' ] ? $defaults[ 'wpsp_no_results' ] : ''
|
844 |
+
)
|
845 |
+
);
|
846 |
}
|
847 |
endif;
|
848 |
|
admin/widget.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Adds WPSP_Widget widget.
|
4 |
+
*/
|
5 |
+
if ( ! class_exists( 'WPSP_Widget' ) ) :
|
6 |
+
class WPSP_Widget extends WP_Widget {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Register widget with WordPress.
|
10 |
+
*/
|
11 |
+
function __construct() {
|
12 |
+
parent::__construct(
|
13 |
+
'wpsp_widget', // Base ID
|
14 |
+
__( 'WP Show Posts', 'wp-show-posts' )
|
15 |
+
);
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Front-end display of widget.
|
20 |
+
*
|
21 |
+
* @see WP_Widget::widget()
|
22 |
+
*
|
23 |
+
* @param array $args Widget arguments.
|
24 |
+
* @param array $instance Saved values from database.
|
25 |
+
*/
|
26 |
+
public function widget( $args, $instance ) {
|
27 |
+
echo $args['before_widget'];
|
28 |
+
if ( ! empty( $instance['title'] ) ) {
|
29 |
+
echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
|
30 |
+
}
|
31 |
+
if ( function_exists( 'wpsp_display' ) ) wpsp_display( absint( $instance['wpsp_id'] ) );
|
32 |
+
echo $args['after_widget'];
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Back-end widget form.
|
37 |
+
*
|
38 |
+
* @see WP_Widget::form()
|
39 |
+
*
|
40 |
+
* @param array $instance Previously saved values from database.
|
41 |
+
*/
|
42 |
+
public function form( $instance ) {
|
43 |
+
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
|
44 |
+
$id = ! empty( $instance['wpsp_id'] ) ? $instance['wpsp_id'] : '';
|
45 |
+
?>
|
46 |
+
<p>
|
47 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( esc_attr( 'Title:' ) ); ?></label>
|
48 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
|
49 |
+
</p>
|
50 |
+
<p>
|
51 |
+
<select name="<?php echo $this->get_field_name( 'wpsp_id' );?>" id="<?php echo $this->get_field_id( 'wpsp_id' );?>">
|
52 |
+
<?php
|
53 |
+
$args = array(
|
54 |
+
'posts_per_page' => -1,
|
55 |
+
'post_type' => 'wp_show_posts',
|
56 |
+
'post_status' => 'publish',
|
57 |
+
'showposts' => -1
|
58 |
+
);
|
59 |
+
$posts = get_posts( $args );
|
60 |
+
|
61 |
+
$count = count( $posts );
|
62 |
+
$types = array();
|
63 |
+
if ( $count > 0 ) {
|
64 |
+
foreach ( $posts as $post ) {
|
65 |
+
echo '<option value="' . $post->ID . '"' . selected( $id, $post->ID ) . '>' . $post->post_title . '</option>';
|
66 |
+
}
|
67 |
+
}
|
68 |
+
?>
|
69 |
+
</select>
|
70 |
+
</p>
|
71 |
+
<?php
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Sanitize widget form values as they are saved.
|
76 |
+
*
|
77 |
+
* @see WP_Widget::update()
|
78 |
+
*
|
79 |
+
* @param array $new_instance Values just sent to be saved.
|
80 |
+
* @param array $old_instance Previously saved values from database.
|
81 |
+
*
|
82 |
+
* @return array Updated safe values to be saved.
|
83 |
+
*/
|
84 |
+
public function update( $new_instance, $old_instance ) {
|
85 |
+
$instance = array();
|
86 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
|
87 |
+
$instance['wpsp_id'] = ( ! empty( $new_instance['wpsp_id'] ) ) ? absint( $new_instance['wpsp_id'] ) : '';
|
88 |
+
|
89 |
+
return $instance;
|
90 |
+
}
|
91 |
+
|
92 |
+
} // class WPSP_Widget
|
93 |
+
endif;
|
94 |
+
|
95 |
+
if ( ! function_exists( 'wpsp_register_widget' ) ) :
|
96 |
+
add_action( 'widgets_init', 'wpsp_register_widget' );
|
97 |
+
function wpsp_register_widget() {
|
98 |
+
register_widget( 'WPSP_Widget' );
|
99 |
+
}
|
100 |
+
endif;
|
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}.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;color:rgba( 0,0,0,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}.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){.col-1,.col-2,.col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.col-9,.col-10,.col-11,.col-12,.col-20{float:left}.col-1{width:8.333333%}.col-2{width:16.666667%}.col-3{width:25%}.col-4{width:33.333%}.col-5{width:41.666667%}.col-6{width:50%}.col-7{width:58.333333%}.col-8{width:66.666667%}.col-9{width:75%}.col-10{width:83.333333%}.col-11{width:91.666667%}.col-12{width:100%}.col-20{width:20%}}.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}
|
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;color:rgba( 0,0,0,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}.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){.col-1,.col-2,.col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.col-9,.col-10,.col-11,.col-12,.col-20{float:left}.col-1{width:8.333333%}.col-2{width:16.666667%}.col-3{width:25%}.col-4{width:33.333%}.col-5{width:41.666667%}.col-6{width:50%}.col-7{width:58.333333%}.col-8{width:66.666667%}.col-9{width:75%}.col-10{width:83.333333%}.col-11{width:91.666667%}.col-12{width:100%}.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-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
@@ -52,6 +52,7 @@ a.wp-show-posts-read-more:focus {
|
|
52 |
.wp-show-posts-image img {
|
53 |
margin: 0 !important;
|
54 |
vertical-align: bottom;
|
|
|
55 |
}
|
56 |
|
57 |
.wp-show-posts-entry-header {
|
@@ -182,6 +183,14 @@ a.wp-show-posts-read-more:focus {
|
|
182 |
}
|
183 |
}
|
184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
/* Spacing */
|
186 |
.wp-show-posts-inner *:last-child {
|
187 |
margin-bottom: 0;
|
52 |
.wp-show-posts-image img {
|
53 |
margin: 0 !important;
|
54 |
vertical-align: bottom;
|
55 |
+
height: auto;
|
56 |
}
|
57 |
|
58 |
.wp-show-posts-entry-header {
|
183 |
}
|
184 |
}
|
185 |
|
186 |
+
@media (max-width: 767px) {
|
187 |
+
.wp-show-posts-columns,
|
188 |
+
.wp-show-posts-inner {
|
189 |
+
margin-left: 0 !important;
|
190 |
+
margin-right: 0 !important;
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
/* Spacing */
|
195 |
.wp-show-posts-inner *:last-child {
|
196 |
margin-bottom: 0;
|
inc/defaults.php
CHANGED
@@ -16,6 +16,7 @@ function wpsp_get_defaults()
|
|
16 |
'wpsp_exclude_current' => false,
|
17 |
'wpsp_excerpt_length' => 30,
|
18 |
'wpsp_post_id' => '',
|
|
|
19 |
'wpsp_ignore_sticky_posts' => false,
|
20 |
'wpsp_image' => true,
|
21 |
'wpsp_image_alignment' => 'center',
|
@@ -54,6 +55,7 @@ function wpsp_get_defaults()
|
|
54 |
'wpsp_wrapper_class' => '',
|
55 |
'wpsp_wrapper_id' => false,
|
56 |
'wpsp_wrapper_style' => '',
|
|
|
57 |
'wpsp_ajax_pagination' => false,
|
58 |
'wpsp_masonry' => false,
|
59 |
'wpsp_social_sharing' => false,
|
16 |
'wpsp_exclude_current' => false,
|
17 |
'wpsp_excerpt_length' => 30,
|
18 |
'wpsp_post_id' => '',
|
19 |
+
'wpsp_exclude_post_id' => '',
|
20 |
'wpsp_ignore_sticky_posts' => false,
|
21 |
'wpsp_image' => true,
|
22 |
'wpsp_image_alignment' => 'center',
|
55 |
'wpsp_wrapper_class' => '',
|
56 |
'wpsp_wrapper_id' => false,
|
57 |
'wpsp_wrapper_style' => '',
|
58 |
+
'wpsp_no_results' => __( 'Sorry, no posts were found.','wp-show-posts' ),
|
59 |
'wpsp_ajax_pagination' => false,
|
60 |
'wpsp_masonry' => false,
|
61 |
'wpsp_social_sharing' => false,
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -59,11 +59,12 @@ Here are the features in the free version:
|
|
59 |
* Include terms
|
60 |
* Terms location
|
61 |
|
62 |
-
= More
|
63 |
|
64 |
* Author ID
|
65 |
* Exclude current
|
66 |
* Post ID
|
|
|
67 |
* Ignore sticky posts
|
68 |
* Offset
|
69 |
* Order
|
@@ -72,6 +73,7 @@ Here are the features in the free version:
|
|
72 |
* Meta key
|
73 |
* Meta value
|
74 |
* Tax operator
|
|
|
75 |
|
76 |
= Our *Pro* version has these features =
|
77 |
|
@@ -147,6 +149,15 @@ In most cases, #1 will work fine and is way easier.
|
|
147 |
|
148 |
== Changelog ==
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
= 0.5 =
|
151 |
* Fix conflict with Yoast SEO causing taxonomy and terms fields to be blank
|
152 |
* Add support for translations
|
@@ -175,6 +186,15 @@ In most cases, #1 will work fine and is way easier.
|
|
175 |
|
176 |
== Upgrade Notice ==
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
= 0.5 =
|
179 |
* Fix conflict with Yoast SEO causing taxonomy and terms fields to be blank
|
180 |
* Add support for translations
|
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.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
59 |
* Include terms
|
60 |
* Terms location
|
61 |
|
62 |
+
= More settings =
|
63 |
|
64 |
* Author ID
|
65 |
* Exclude current
|
66 |
* Post ID
|
67 |
+
* Exclude post ID
|
68 |
* Ignore sticky posts
|
69 |
* Offset
|
70 |
* Order
|
73 |
* Meta key
|
74 |
* Meta value
|
75 |
* Tax operator
|
76 |
+
* No results message
|
77 |
|
78 |
= Our *Pro* version has these features =
|
79 |
|
149 |
|
150 |
== Changelog ==
|
151 |
|
152 |
+
= 0.6 =
|
153 |
+
* Add height: auto to images to prevent image stretching in Beaver Builder
|
154 |
+
* Prevent horizontal scrolling when posts are in columns
|
155 |
+
* Change "More query args" section name to "More settings"
|
156 |
+
* Allow multiple IDs in "Post ID" option
|
157 |
+
* Add "Exclude IDs" option
|
158 |
+
* Add "No results message" option
|
159 |
+
* Add "WP Show Posts" widget to add posts in widget areas
|
160 |
+
|
161 |
= 0.5 =
|
162 |
* Fix conflict with Yoast SEO causing taxonomy and terms fields to be blank
|
163 |
* Add support for translations
|
186 |
|
187 |
== Upgrade Notice ==
|
188 |
|
189 |
+
= 0.6 =
|
190 |
+
* Add height: auto to images to prevent image stretching in Beaver Builder
|
191 |
+
* Prevent horizontal scrolling when posts are in columns
|
192 |
+
* Change "More query args" section name to "More settings"
|
193 |
+
* Allow multiple IDs in "Post ID" option
|
194 |
+
* Add "Exclude IDs" option
|
195 |
+
* Add "No results message" option
|
196 |
+
* Add "WP Show Posts" widget to add posts in widget areas
|
197 |
+
|
198 |
= 0.5 =
|
199 |
* Fix conflict with Yoast SEO causing taxonomy and terms fields to be blank
|
200 |
* Add support for translations
|
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
|
@@ -35,6 +35,9 @@ require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'inc/functions.php
|
|
35 |
// Add admin functions
|
36 |
require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'admin/admin.php';
|
37 |
|
|
|
|
|
|
|
38 |
if ( ! function_exists( 'wpsp_load_textdomain' ) ) :
|
39 |
/**
|
40 |
* Load plugin textdomain.
|
@@ -103,7 +106,8 @@ function wpsp_display( $id )
|
|
103 |
$content_type = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_content_type' ) );
|
104 |
$exclude_current = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_exclude_current' ) );
|
105 |
$excerpt_length = absint( wpsp_get_setting( $id, 'wpsp_excerpt_length' ) );
|
106 |
-
$post_id =
|
|
|
107 |
$ignore_sticky_posts = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_ignore_sticky_posts' ) );
|
108 |
$image_gallery = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_image_gallery' ) );
|
109 |
$image_lightbox = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_image_lightbox' ) );
|
@@ -134,6 +138,7 @@ function wpsp_display( $id )
|
|
134 |
$wrapper_id = sanitize_html_class( wpsp_get_setting( $id, 'wpsp_wrapper_id' ) );
|
135 |
$wrapper_class = array_map( 'sanitize_html_class', ( explode( ' ', wpsp_get_setting( $id, 'wpsp_wrapper_class' ) ) ) );
|
136 |
$wrapper_style = explode( ' ', esc_attr( wpsp_get_setting( $id, 'wpsp_wrapper_style' ) ) );
|
|
|
137 |
$ajax_pagination = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_ajax_pagination' ) );
|
138 |
$masonry = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_masonry' ) );
|
139 |
$featured_post = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_featured_post' ) );
|
@@ -227,6 +232,12 @@ function wpsp_display( $id )
|
|
227 |
$args['post__in'] = $posts_in;
|
228 |
}
|
229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
// If Exclude Current
|
231 |
if( is_singular() && $exclude_current )
|
232 |
$args['post__not_in'] = array( get_the_ID() );
|
@@ -247,8 +258,8 @@ function wpsp_display( $id )
|
|
247 |
if ( $columns !== 'col-12' ) :
|
248 |
wp_enqueue_script( 'wpsp-matchHeight', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'js/jquery.matchHeight.js', array( 'jquery' ), WPSP_VERSION, true );
|
249 |
$wrapper_class[] = 'wp-show-posts-columns';
|
250 |
-
$wrapper_style[] = 'margin-
|
251 |
-
$inner_wrapper_style[] = 'margin: 0 ' . $columns_gutter . ' ' . $columns_gutter . '
|
252 |
endif;
|
253 |
|
254 |
// Featured post class
|
@@ -311,6 +322,8 @@ function wpsp_display( $id )
|
|
311 |
// Get the wrapper ID
|
312 |
if( !empty( $wrapper_id ) )
|
313 |
$wrapper_id = ' id="' . $wrapper_id . '"';
|
|
|
|
|
314 |
|
315 |
do_action( 'wpsp_before_wrapper' );
|
316 |
|
@@ -324,7 +337,7 @@ function wpsp_display( $id )
|
|
324 |
// endif;
|
325 |
|
326 |
// Start the wrapper
|
327 |
-
echo '<' . $wrapper . $wrapper_id . $wrapper_class . $wrapper_style . '>';
|
328 |
|
329 |
if ( $masonry )
|
330 |
echo '<div class="grid-sizer ' . $columns . '"></div>';
|
@@ -407,7 +420,9 @@ function wpsp_display( $id )
|
|
407 |
}
|
408 |
} else {
|
409 |
// no posts found
|
410 |
-
echo
|
|
|
|
|
411 |
}
|
412 |
if ( $columns !== 'col-12' ) echo '<div class="wpsp-clear"></div>';
|
413 |
echo '</' . $wrapper . '><!-- .wp-show-posts -->';
|
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.6
|
7 |
Author: Tom Usborne
|
8 |
Author URI: https://tomusborne.com
|
9 |
License: GNU General Public License v2 or later
|
35 |
// Add admin functions
|
36 |
require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'admin/admin.php';
|
37 |
|
38 |
+
// Add widget
|
39 |
+
require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'admin/widget.php';
|
40 |
+
|
41 |
if ( ! function_exists( 'wpsp_load_textdomain' ) ) :
|
42 |
/**
|
43 |
* Load plugin textdomain.
|
106 |
$content_type = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_content_type' ) );
|
107 |
$exclude_current = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_exclude_current' ) );
|
108 |
$excerpt_length = absint( wpsp_get_setting( $id, 'wpsp_excerpt_length' ) );
|
109 |
+
$post_id = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_post_id' ) );
|
110 |
+
$exclude_post_id = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_exclude_post_id' ) );
|
111 |
$ignore_sticky_posts = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_ignore_sticky_posts' ) );
|
112 |
$image_gallery = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_image_gallery' ) );
|
113 |
$image_lightbox = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_image_lightbox' ) );
|
138 |
$wrapper_id = sanitize_html_class( wpsp_get_setting( $id, 'wpsp_wrapper_id' ) );
|
139 |
$wrapper_class = array_map( 'sanitize_html_class', ( explode( ' ', wpsp_get_setting( $id, 'wpsp_wrapper_class' ) ) ) );
|
140 |
$wrapper_style = explode( ' ', esc_attr( wpsp_get_setting( $id, 'wpsp_wrapper_style' ) ) );
|
141 |
+
$no_results = wp_kses_post( wpsp_get_setting( $id, 'wpsp_no_results' ) );
|
142 |
$ajax_pagination = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_ajax_pagination' ) );
|
143 |
$masonry = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_masonry' ) );
|
144 |
$featured_post = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_featured_post' ) );
|
232 |
$args['post__in'] = $posts_in;
|
233 |
}
|
234 |
|
235 |
+
// If Exclude Post IDs
|
236 |
+
if( $exclude_post_id ) {
|
237 |
+
$posts_not_in = array_map( 'intval', explode( ',', $exclude_post_id ) );
|
238 |
+
$args['post__not_in'] = $posts_not_in;
|
239 |
+
}
|
240 |
+
|
241 |
// If Exclude Current
|
242 |
if( is_singular() && $exclude_current )
|
243 |
$args['post__not_in'] = array( get_the_ID() );
|
258 |
if ( $columns !== 'col-12' ) :
|
259 |
wp_enqueue_script( 'wpsp-matchHeight', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'js/jquery.matchHeight.js', array( 'jquery' ), WPSP_VERSION, true );
|
260 |
$wrapper_class[] = 'wp-show-posts-columns';
|
261 |
+
$wrapper_style[] = 'margin-left:-' . $columns_gutter . ';';
|
262 |
+
$inner_wrapper_style[] = 'margin: 0 0 ' . $columns_gutter . ' ' . $columns_gutter . ';' . $border . $padding;
|
263 |
endif;
|
264 |
|
265 |
// Featured post class
|
322 |
// Get the wrapper ID
|
323 |
if( !empty( $wrapper_id ) )
|
324 |
$wrapper_id = ' id="' . $wrapper_id . '"';
|
325 |
+
|
326 |
+
$wrapper_atts = apply_filters( 'wpsp_wrapper_atts', '' );
|
327 |
|
328 |
do_action( 'wpsp_before_wrapper' );
|
329 |
|
337 |
// endif;
|
338 |
|
339 |
// Start the wrapper
|
340 |
+
echo '<' . $wrapper . $wrapper_id . $wrapper_class . $wrapper_style . $wrapper_atts . '>';
|
341 |
|
342 |
if ( $masonry )
|
343 |
echo '<div class="grid-sizer ' . $columns . '"></div>';
|
420 |
}
|
421 |
} else {
|
422 |
// no posts found
|
423 |
+
echo ( $columns !== 'col-12' ) ? '<div class="wpsp-no-results" style="margin-left: ' . $columns_gutter . ';">' : '';
|
424 |
+
echo wpautop( $no_results );
|
425 |
+
echo ( $columns !== 'col-12' ) ? '</div>' : '';
|
426 |
}
|
427 |
if ( $columns !== 'col-12' ) echo '<div class="wpsp-clear"></div>';
|
428 |
echo '</' . $wrapper . '><!-- .wp-show-posts -->';
|