Plugin Directory

Changeset 1476018 for wp-show-posts


Ignore:
Timestamp:
08/16/2016 09:36:46 PM (9 years ago)
Author:
edge22
Message:

Release 0.6

Location:
wp-show-posts/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • wp-show-posts/trunk/admin/metabox.php

    r1460515 r1476018  
    577577        'wpsp_query_args',
    578578        array(
    579             'label' => esc_html__( 'More query args', 'wp-show-posts' ),
     579            'label' => esc_html__( 'More settings', 'wp-show-posts' ),
    580580            'icon'  => 'dashicons-admin-generic',
    581581            'priority' => 999
     
    621621        'wpsp_post_id', // Same as setting name.
    622622        array(
    623             'type'    => 'number',
    624             'section' => 'wpsp_query_args',
    625             'label'   => esc_html__( 'Post ID', 'wp-show-posts' )
     623            'type'    => 'text',
     624            'section' => 'wpsp_query_args',
     625            'label'   => esc_html__( 'Post IDs', 'wp-show-posts' )
    626626        )
    627627    );
     
    630630        'wpsp_post_id', // Same as control name.
    631631        array(
    632             'sanitize_callback' => 'wpsp_sanitize_intval',
     632            'sanitize_callback' => 'sanitize_text_field',
    633633            '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' ] : ''
    634651        )
    635652    );
     
    810827        )
    811828    );
     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    );
    812846}
    813847endif;
  • wp-show-posts/trunk/css/wp-show-posts-min.css

    r1462786 r1476018  
    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}
     1body .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}
  • wp-show-posts/trunk/css/wp-show-posts.css

    r1462786 r1476018  
    5353    margin: 0 !important;
    5454    vertical-align: bottom;
     55    height: auto;
    5556}
    5657
     
    180181  .col-20 {
    181182    width: 20%;
     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;
    182191   }
    183192}
  • wp-show-posts/trunk/inc/defaults.php

    r1462786 r1476018  
    1717        'wpsp_excerpt_length'     => 30,
    1818        'wpsp_post_id'            => '',
     19        'wpsp_exclude_post_id'            => '',
    1920        'wpsp_ignore_sticky_posts' => false,
    2021        'wpsp_image'              => true,
     
    5556        'wpsp_wrapper_id'          => false,
    5657        'wpsp_wrapper_style'       => '',
     58        'wpsp_no_results'          => __( 'Sorry, no posts were found.','wp-show-posts' ),
    5759        'wpsp_ajax_pagination'     => false,
    5860        'wpsp_masonry'            => false,
  • wp-show-posts/trunk/readme.txt

    r1467146 r1476018  
    55Requires at least: 4.0
    66Tested up to: 4.6
    7 Stable tag: 0.5
     7Stable tag: 0.6
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    148148== Changelog ==
    149149
     150= 0.6 =
     151* Add height: auto to images to prevent image stretching in Beaver Builder
     152* Prevent horizontal scrolling when posts are in columns
     153* Change "More query args" section name to "More settings"
     154* Allow multiple IDs in "Post ID" option
     155* Add "Exclude IDs" option
     156* Add "No results message" option
     157* Add "WP Show Posts" widget to add posts in widget areas
     158
    150159= 0.5 =
    151160* Fix conflict with Yoast SEO causing taxonomy and terms fields to be blank
     
    176185== Upgrade Notice ==
    177186
     187= 0.6 =
     188* Add height: auto to images to prevent image stretching in Beaver Builder
     189* Prevent horizontal scrolling when posts are in columns
     190* Change "More query args" section name to "More settings"
     191* Allow multiple IDs in "Post ID" option
     192* Add "Exclude IDs" option
     193* Add "No results message" option
     194* Add "WP Show Posts" widget to add posts in widget areas
     195
    178196= 0.5 =
    179197* Fix conflict with Yoast SEO causing taxonomy and terms fields to be blank
  • wp-show-posts/trunk/wp-show-posts.php

    r1467146 r1476018  
    44Plugin URI: https://wpshowposts.com
    55Description: 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.5
     6Version: 0.6
    77Author: Tom Usborne
    88Author URI: https://tomusborne.com
     
    3535// Add admin functions
    3636require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'admin/admin.php';
     37
     38// Add widget
     39require_once trailingslashit( plugin_dir_path( __FILE__ ) ) . 'admin/widget.php';
    3740
    3841if ( ! function_exists( 'wpsp_load_textdomain' ) ) :
     
    104107    $exclude_current        = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_exclude_current' ) );
    105108    $excerpt_length         = absint( wpsp_get_setting( $id, 'wpsp_excerpt_length' ) );
    106     $post_id                = absint( wpsp_get_setting( $id, 'wpsp_post_id' ) );
     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' ) );
    107111    $ignore_sticky_posts    = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_ignore_sticky_posts' ) );
    108112    $image_gallery          = sanitize_text_field( wpsp_get_setting( $id, 'wpsp_image_gallery' ) );
     
    135139    $wrapper_class          = array_map( 'sanitize_html_class', ( explode( ' ', wpsp_get_setting( $id, 'wpsp_wrapper_class' ) ) ) );
    136140    $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' ) );
    137142    $ajax_pagination        = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_ajax_pagination' ) );
    138143    $masonry                = wp_validate_boolean( wpsp_get_setting( $id, 'wpsp_masonry' ) );
     
    228233    }
    229234   
     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   
    230241    // If Exclude Current
    231242    if( is_singular() && $exclude_current )
     
    248259        wp_enqueue_script( 'wpsp-matchHeight', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'js/jquery.matchHeight.js', array( 'jquery' ), WPSP_VERSION, true );
    249260        $wrapper_class[] = 'wp-show-posts-columns';
    250         $wrapper_style[] = 'margin-right:-' . $columns_gutter . ';';
    251         $inner_wrapper_style[] = 'margin: 0 ' . $columns_gutter . ' ' . $columns_gutter . ' 0;' . $border . $padding;
     261        $wrapper_style[] = 'margin-left:-' . $columns_gutter . ';';
     262        $inner_wrapper_style[] = 'margin: 0 0 ' . $columns_gutter . ' ' . $columns_gutter . ';' . $border . $padding;
    252263    endif;
    253264
     
    312323    if( !empty( $wrapper_id ) )
    313324        $wrapper_id = ' id="' . $wrapper_id . '"';
     325   
     326    $wrapper_atts = apply_filters( 'wpsp_wrapper_atts', '' );
    314327
    315328    do_action( 'wpsp_before_wrapper' );
     
    325338   
    326339    // Start the wrapper
    327     echo '<' . $wrapper . $wrapper_id . $wrapper_class . $wrapper_style . '>';
     340    echo '<' . $wrapper . $wrapper_id . $wrapper_class . $wrapper_style . $wrapper_atts . '>';
    328341
    329342    if ( $masonry )
     
    408421    } else {
    409422        // no posts found
    410         echo apply_filters( 'wpsp_shortcode_no_results', wpautop( __( 'Sorry, no posts were found.','wp-show-posts' ) ) );
     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>' : '';
    411426    }
    412427        if ( $columns !== 'col-12' ) echo '<div class="wpsp-clear"></div>';
Note: See TracChangeset for help on using the changeset viewer.