Category Posts Widget - Version 4.7.2

Version Description

  • February 25th 2017 =
  • Add option to disable only the font styles
  • Fixed if option 'Everything is a link' no closing anchor tag
  • Fixed if option 'Everyting is a link' wrong layout
  • Fixed when a manual excerpt is provided, use it instead of generating an automatic one
  • Fixed if option 'Disable the built-in CSS' the thumbnail client-side cropping isn't disabled
  • Fixed if option 'Disable the built-in CSS' title class is not rendered
  • Fixed when having multi shortcodes, clicking on a checkbox label marks in any of them selects the one in the "first"
  • Fixed if option 'CSS crop to requested size' for multi shortcodes
  • Fixed for CSS animation
Download this release

Release Info

Developer Kometschuh
Plugin Icon 128x128 Category Posts Widget
Version 4.7.2
Comparing to
See all releases

Code changes from version 4.7.1 to 4.7.2

Files changed (3) hide show
  1. cat-posts.php +237 -168
  2. js/admin/category-posts-widget.js +178 -150
  3. readme.txt +31 -17
cat-posts.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Category Posts Widget
4
  Plugin URI: https://wordpress.org/plugins/category-posts/
5
  Description: Adds a widget that shows the most recent posts from a single category.
6
  Author: TipTopPress
7
- Version: 4.7.1
8
  Author URI: http://tiptoppress.com
9
  Text Domain: category-posts
10
  Domain Path: /languages
@@ -15,7 +15,7 @@ namespace categoryPosts;
15
  // Don't call the file directly
16
  if ( !defined( 'ABSPATH' ) ) exit;
17
 
18
- const CAT_POST_VERSION = "4.7.1";
19
  const CAT_POST_DOC_URL = "http://tiptoppress.com/category-posts-widget/documentation-4-7?utm_source=widget_cpw&utm_campaign=documentation_4_7_cpw&utm_medium=form";
20
 
21
  const SHORTCODE_NAME = 'catposts';
@@ -230,7 +230,6 @@ function admin_styles() {
230
  }
231
  .category-widget-cont > div {
232
  display:none;
233
- overflow: hidden;
234
  }
235
  .category-widget-cont > div.open {
236
  display:block;
@@ -339,7 +338,7 @@ class Widget extends \WP_Widget {
339
  .'px;clip:rect(auto,'.($this->instance['thumb_w']+$image['marginVal']).'px,auto,'.$image['marginVal']
340
  .'px);width:auto;max-width:initial;" ',$html);
341
  // wrap span
342
- $html = '<span style="width:'.$this->instance['thumb_w'].'px;height:'.$this->instance['thumb_h'].'px;">'
343
  .$html.'</span>';
344
  } else {
345
  // use_css_cropping is not used
@@ -399,7 +398,7 @@ class Widget extends \WP_Widget {
399
  * Excerpt more link filter
400
  */
401
  function excerpt_more_filter($more) {
402
- return ' <a class="cat-post-excerpt-more" href="'. get_permalink() . '">' . esc_html($this->instance["excerpt_more_text"]) . '</a>';
403
  }
404
 
405
  /**
@@ -490,41 +489,28 @@ class Widget extends \WP_Widget {
490
 
491
  if ( isset( $instance["thumb"] ) && $instance["thumb"] &&
492
  ((isset($instance['default_thunmbnail']) && ($instance['default_thunmbnail']!= 0)) || has_post_thumbnail()) ) {
493
- $use_css_cropping = (isset($this->instance['use_css_cropping'])&&$this->instance['use_css_cropping']) ? "cat-post-css-cropping" : "";
494
- if ($use_css_cropping){
495
- // enque relevant scripts and parameters to perform cropping
496
- // once we support only 4.5+ it can be refactored to use wp_add_inline_script
497
- wp_enqueue_script( 'jquery'); // just in case the theme or other plugins didn't enqueue it
498
- add_action('wp_footer', __NAMESPACE__.'\change_cropped_image_dimensions', 100); // add to the footer the cropping script
499
- $number = $this->number;
500
- // a temporary hack to handle difference in the number in a true widget
501
- // and the number format expected at the rest of the places
502
- if (is_numeric($number))
503
- $number = WIDGET_BASE_ID .'-'.$number;
504
-
505
- // add Javascript to change change cropped image dimensions on load and window resize
506
- $thumb_w = $this->instance['thumb_w'];
507
- $thumb_h = $this->instance['thumb_h'];
508
- add_filter('cpw_crop_widgets', function ($a) use ($number, $thumb_w, $thumb_h) {
509
- $a[$number] = $thumb_w / $thumb_h;
510
- return $a;
511
- });
512
- }
513
-
514
- $class = '';
515
- if( !(isset( $this->instance['disable_css'] ) && $this->instance['disable_css'])) {
516
  if( isset($this->instance['thumb_hover'] )) {
517
- $class = "class=\"cat-post-thumbnail " . $use_css_cropping ." cat-post-" . $instance['thumb_hover'] . "\"";
518
  } else {
519
- $class = "class=\"cat-post-thumbnail " . $use_css_cropping . "\"";
520
  }
521
- }
 
522
  $title_args = array('echo'=>false);
 
523
  if ($no_link)
524
  $ret .= '<span '.$class . '">';
525
  else
526
  $ret .= '<a '.$class . ' href="'.get_the_permalink().'" title="'.the_title_attribute($title_args).'">';
 
527
  $ret .= $this->the_post_thumbnail( array($this->instance['thumb_w'],$this->instance['thumb_h']));
 
528
  if ($no_link)
529
  $ret .= '</span>';
530
  else
@@ -636,12 +622,12 @@ class Widget extends \WP_Widget {
636
  } else
637
  $ret .= $title;
638
 
639
- $ret .= $after_title;
640
- }
641
-
642
- return $ret;
643
- }
644
-
645
  /**
646
  * Calculate the HTML of the footer based on the widget settings
647
  *
@@ -650,31 +636,35 @@ class Widget extends \WP_Widget {
650
  *
651
  * @since 4.6
652
  */
653
- function footerHTML($instance) {
654
- $ret = '';
655
-
656
- if( isset ( $instance["footer_link"] ) && $instance["footer_link"]) {
 
 
657
  $ret = "<a";
658
  if( !(isset( $instance['disable_css'] ) && $instance['disable_css'])) {
659
  $ret.= " class=\"cat-post-footer-link\"";
660
  }
661
  if (isset($instance["cat"]) && ($instance["cat"] != 0) && (get_category($instance["cat"]) != null) ) {
662
- $ret .= " href=\"" . get_category_link($instance["cat"]) . "\">" . esc_html($instance["footer_link"]) . "</a>";
663
  } else {
664
  // link to posts page if category not found.
665
  // this maybe the blog page or home page
666
- $blog_page = get_option('page_for_posts');
667
- if ($blog_page)
668
- $ret .= " href=\"" . get_permalink($blog_page) . "\">" . esc_html($instance["footer_link"]) . "</a>";
669
- else
670
- $ret .= " href=\"" . home_url() . "\">" . esc_html($instance["footer_link"]) . "</a>";
 
 
 
 
671
  }
672
  }
673
-
674
-
675
- return $ret;
676
- }
677
-
678
  /**
679
  * Calculate the HTML for a post item based on the widget settings and post.
680
  * Expected to be called in an active loop with all the globals set
@@ -690,6 +680,7 @@ class Widget extends \WP_Widget {
690
  global $post;
691
 
692
  $everything_is_link = isset( $instance['everything_is_link'] ) && $instance['everything_is_link'];
 
693
 
694
  $ret = '<li ';
695
 
@@ -702,8 +693,9 @@ class Widget extends \WP_Widget {
702
  $ret.='>'; // close the li opening tag
703
 
704
  if ($everything_is_link) {
705
- $ret .= '<a href="'.get_the_permalink().'" title="">';
706
  }
 
707
  // Thumbnail position to top
708
  if( isset( $instance["thumbTop"] ) && $instance["thumbTop"]) {
709
  $ret .= $this->show_thumb($instance,$everything_is_link);
@@ -715,7 +707,7 @@ class Widget extends \WP_Widget {
715
  $ret .= '<span class="cat-post-title">'.get_the_title().'</span>';
716
  } else {
717
  $ret .= '<a class="post-title';
718
- if( !isset( $instance['disable_css'] ) ) {
719
  $ret .= " cat-post-title";
720
  }
721
  $ret .= '" href="'.get_the_permalink().'" rel="bookmark">'.get_the_title();
@@ -730,16 +722,16 @@ class Widget extends \WP_Widget {
730
  } else {
731
  $date_format = "j M Y";
732
  }
733
- $ret .= '<p class="post-date ';
734
- if( !isset( $instance['disable_css'] ) ) {
735
- $ret .= "cat-post-date";
736
  }
737
  $ret .= '">';
738
  if ( isset ( $instance["date_link"] ) && $instance["date_link"] && !$everything_is_link) {
739
  $ret .= '<a href="'.\get_the_permalink().'">';
740
  }
741
  $ret .= get_the_time($date_format);
742
- if ( isset ( $instance["date_link"] ) && !$everything_is_link ) {
743
  $ret .= '</a>';
744
  }
745
  $ret .= '</p>';
@@ -762,20 +754,24 @@ class Widget extends \WP_Widget {
762
  if (!isset($instance['excerpt_filters']) || $instance['excerpt_filters']) { // pre 4.7 widgets has filters on
763
  $excerpt = apply_filters('the_excerpt', \get_the_excerpt() );
764
  } else { // if filters off replicate functionality of core generating excerpt
765
- $text = get_the_content('');
766
- $text = strip_shortcodes( $text );
767
- $more_text = '[&hellip;]';
768
- if( isset($instance["excerpt_more_text"]) && $instance["excerpt_more_text"] )
769
- $more_text = ltrim($instance["excerpt_more_text"]);
770
-
771
- if ($everything_is_link)
772
- $excerpt_more_text = ' <span class="cat-post-excerpt-more">'.$more_text.'</span>';
773
- else
774
- $excerpt_more_text = ' <a class="cat-post-excerpt-more" href="'. get_permalink() . '" title="'.sprintf(__('Continue reading %s'),get_the_title()).'">' . $more_text . '</a>';
775
- $excerpt = \wp_trim_words( $text, $length, $excerpt_more_text );
776
- // adjust html output same way as for the normal excerpt,
777
- // just force all functions depending on the_excerpt hook
778
- $excerpt = shortcode_unautop(wpautop(convert_chars(convert_smilies(wptexturize($excerpt)))));
 
 
 
 
779
  }
780
  $ret .= apply_filters('cpw_excerpt',$excerpt);
781
  }
@@ -783,7 +779,7 @@ class Widget extends \WP_Widget {
783
  // Comments
784
  if ( isset( $instance['comment_num'] ) && $instance['comment_num']) {
785
  $ret .= '<p class="comment-num';
786
- if ( !isset( $instance['disable_css'] ) ) {
787
  $ret .= " cat-post-comment-num";
788
  }
789
  $ret .= '">';
@@ -793,9 +789,9 @@ class Widget extends \WP_Widget {
793
 
794
  // Author
795
  if ( isset( $instance['author'] ) && $instance['author']) {
796
- $ret .= '<p class="post-author ';
797
- if( !isset( $instance['disable_css'] ) ) {
798
- $ret .= "cat-post-author";
799
  }
800
  $ret .= '">';
801
  global $authordata;
@@ -812,6 +808,10 @@ class Widget extends \WP_Widget {
812
  }
813
  $ret .= '</p>';
814
  }
 
 
 
 
815
 
816
  $ret .= '</li>';
817
  return $ret;
@@ -927,6 +927,28 @@ class Widget extends \WP_Widget {
927
  $this->removeExcerpFilters($instance);
928
 
929
  wp_reset_postdata();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
930
  }
931
  }
932
 
@@ -997,7 +1019,7 @@ class Widget extends \WP_Widget {
997
  */
998
  function formFilterPanel($instance) {
999
  $instance = wp_parse_args( ( array ) $instance, array(
1000
- 'cat' => '',
1001
  'num' => get_option('posts_per_page'),
1002
  'offset' => 1,
1003
  'sort_by' => '',
@@ -1020,7 +1042,7 @@ class Widget extends \WP_Widget {
1020
  <p>
1021
  <label>
1022
  <?php _e( 'Category','category-posts' ); ?>:
1023
- <?php wp_dropdown_categories( array( 'show_option_all' => __('All categories','category-posts'), 'hide_empty'=> 0, 'name' => $this->get_field_name("cat"), 'selected' => $instance["cat"] ) ); ?>
1024
  </label>
1025
  </p>
1026
  <p>
@@ -1037,7 +1059,7 @@ class Widget extends \WP_Widget {
1037
  </p>
1038
  <p>
1039
  <label for="<?php echo $this->get_field_id("offset"); ?>">
1040
- <?php _e('Start offsett','category-posts'); ?>:
1041
  <input style="text-align: center; width: 30%;" id="<?php echo $this->get_field_id("offset"); ?>" name="<?php echo $this->get_field_name("offset"); ?>" type="number" min="1" value="<?php echo absint($instance["offset"]); ?>" />
1042
  </label>
1043
  </p>
@@ -1116,7 +1138,7 @@ class Widget extends \WP_Widget {
1116
  </p>
1117
  <p>
1118
  <label>
1119
- <?php _e('Thumbnail dimensions (in pixels)','category-posts'); ?>:<br />
1120
  <label for="<?php echo $this->get_field_id("thumb_w"); ?>">
1121
  <?php _e('Width:','category-posts')?> <input class="widefat" style="width:30%;" type="number" min="1" id="<?php echo $this->get_field_id("thumb_w"); ?>" name="<?php echo $this->get_field_name("thumb_w"); ?>" value="<?php echo esc_attr($instance["thumb_w"]); ?>" />
1122
  </label>
@@ -1131,10 +1153,22 @@ class Widget extends \WP_Widget {
1131
  <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("use_css_cropping"); ?>" name="<?php echo $this->get_field_name("use_css_cropping"); ?>"<?php checked( (bool) $instance["use_css_cropping"], true ); ?> />
1132
  <?php _e( 'CSS crop to requested size ','category-posts' ); ?>
1133
  </label>
1134
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
1135
  <p>
1136
  <label style="display:block">
1137
- <?php _e( 'Default thumbnail ','category-posts' ); ?>
1138
  </label>
1139
  <input type="hidden" class="default_thumb_id" id="<?php echo $this->get_field_id("default_thunmbnail"); ?>" name="<?php echo $this->get_field_name("default_thunmbnail"); ?>" value="<?php echo esc_attr($default_thunmbnail)?>"/>
1140
  <span class="default_thumb_img">
@@ -1156,18 +1190,6 @@ class Widget extends \WP_Widget {
1156
  <?php _e('No default','category-posts')?>
1157
  </button>
1158
  </p>
1159
- <p>
1160
- <label for="<?php echo $this->get_field_id("thumb_hover"); ?>">
1161
- <?php _e( 'Animation on mouse hover:','category-posts' ); ?>
1162
- </label>
1163
- <select id="<?php echo $this->get_field_id("thumb_hover"); ?>" name="<?php echo $this->get_field_name("thumb_hover"); ?>">
1164
- <option value="none" <?php selected($thumb_hover, 'none')?>><?php _e( 'None', 'category-posts' ); ?></option>
1165
- <option value="dark" <?php selected($thumb_hover, 'dark')?>><?php _e( 'Darker', 'category-posts' ); ?></option>
1166
- <option value="white" <?php selected($thumb_hover, 'white')?>><?php _e( 'Brighter', 'category-posts' ); ?></option>
1167
- <option value="scale" <?php selected($thumb_hover, 'scale')?>><?php _e( 'Zoom in', 'category-posts' ); ?></option>
1168
- <option value="blur" <?php selected($thumb_hover, 'blur')?>><?php _e( 'Blur', 'category-posts' ); ?></option>
1169
- </select>
1170
- </p>
1171
  </div>
1172
  <?php
1173
  }
@@ -1187,6 +1209,7 @@ class Widget extends \WP_Widget {
1187
  }
1188
  $instance = wp_parse_args( ( array ) $instance, array(
1189
  'everything_is_link' => false,
 
1190
  'footer_link' => '',
1191
  'hide_post_titles' => '',
1192
  'excerpt' => '',
@@ -1199,11 +1222,13 @@ class Widget extends \WP_Widget {
1199
  'date_link' => '',
1200
  'date_format' => '',
1201
  'disable_css' => '',
 
1202
  'hide_if_empty' => '',
1203
  'hide_social_buttons' => '',
1204
  ) );
1205
 
1206
  $everything_is_link = $instance['everything_is_link'];
 
1207
  $footer_link = $instance['footer_link'];
1208
  $hide_post_titles = $instance['hide_post_titles'];
1209
  $excerpt = $instance['excerpt'];
@@ -1216,7 +1241,10 @@ class Widget extends \WP_Widget {
1216
  $date_link = $instance['date_link'];
1217
  $date_format = $instance['date_format'];
1218
  $disable_css = $instance['disable_css'];
 
1219
  $hide_if_empty = $instance['hide_if_empty'];
 
 
1220
 
1221
 
1222
  if (!isset($style_done)) { // what an ugly hack, but can't figure out how to do it nicer on 4.3
@@ -1292,7 +1320,7 @@ class Widget extends \WP_Widget {
1292
  <p>
1293
  <label for="<?php echo $this->get_field_id("excerpt_filters"); ?>">
1294
  <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("excerpt_filters"); ?>" name="<?php echo $this->get_field_name("excerpt_filters"); ?>"<?php checked( !empty($excerpt_filters), true ); ?> />
1295
- <?php _e( 'Themes and plugins may override','category-posts' ); ?>
1296
  </label>
1297
  </p>
1298
  </div>
@@ -1331,12 +1359,18 @@ class Widget extends \WP_Widget {
1331
  </div>
1332
  <h4 data-panel="general"><?php _e('General','category-posts')?></h4>
1333
  <div>
1334
- <p>
1335
  <label for="<?php echo $this->get_field_id("disable_css"); ?>">
1336
  <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("disable_css"); ?>" name="<?php echo $this->get_field_name("disable_css"); ?>"<?php checked( (bool) $instance["disable_css"], true ); ?> />
1337
  <?php _e( 'Disable the built-in CSS for this widget','category-posts' ); ?>
1338
  </label>
1339
  </p>
 
 
 
 
 
 
1340
  <p>
1341
  <label for="<?php echo $this->get_field_id("hide_if_empty"); ?>">
1342
  <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("hide_if_empty"); ?>" name="<?php echo $this->get_field_name("hide_if_empty"); ?>"<?php checked( (bool) $instance["hide_if_empty"], true ); ?> />
@@ -1347,11 +1381,17 @@ class Widget extends \WP_Widget {
1347
  <h4 data-panel="footer"><?php _e('Footer','category-posts')?></h4>
1348
  <div>
1349
  <p>
1350
- <label for="<?php echo $this->get_field_id("footer_link"); ?>">
1351
  <?php _e( 'Footer link text','category-posts' ); ?>:
1352
- <input class="widefat" style="width:60%;" placeholder="<?php _e('... more by this topic','category-posts')?>" id="<?php echo $this->get_field_id("footer_link"); ?>" name="<?php echo $this->get_field_name("footer_link"); ?>" type="text" value="<?php echo esc_attr($instance["footer_link"]); ?>" />
1353
  </label>
1354
  </p>
 
 
 
 
 
 
1355
  </div>
1356
  <p><a href="<?php echo get_edit_user_link().'#'.__NAMESPACE__ ?>"><?php _e('Widget admin behaviour settings','category-posts')?></a></p>
1357
  <p><a target="_blank" href="<?php echo CAT_POST_DOC_URL ?>"><?php _e('Documentation','category-posts'); ?></a></p>
@@ -1411,9 +1451,8 @@ function change_cropped_image_dimensions() {
1411
  cwp_namespace.fluid_images = {
1412
 
1413
  <?php /* variables */ ?>
1414
- Posts : {},
1415
  widget : null,
1416
- Spans : {},
1417
 
1418
  <?php /* class */ ?>
1419
  Span : function (_self, _imageRatio) {
@@ -1427,7 +1466,8 @@ function change_cropped_image_dimensions() {
1427
  WidgetPosts : function (widget, ratio) {
1428
 
1429
  <?php /* variables */ ?>
1430
- this.allSpans = widget.find( '.cat-post-thumbnail > span' );
 
1431
  this.firstSpan = this.allSpans.first();
1432
  this.maxSpanWidth = this.firstSpan.width();
1433
  this.firstListItem = this.firstSpan.closest( 'li' );
@@ -1435,7 +1475,7 @@ function change_cropped_image_dimensions() {
1435
 
1436
  for( var i = 0; i < this.allSpans.length; i++ ){
1437
  var imageRatio = this.firstSpan.width() / jQuery(this.allSpans[i]).find( 'img' ).height();
1438
- cwp_namespace.fluid_images.Spans[i] = new cwp_namespace.fluid_images.Span( jQuery(this.allSpans[i]), imageRatio );
1439
  }
1440
 
1441
  <?php /* functions */ ?>
@@ -1450,9 +1490,9 @@ function change_cropped_image_dimensions() {
1450
  var spanHeight = this.listItemWidth / this.ratio;
1451
  this.allSpans.height( spanHeight );
1452
 
1453
- for( var index in cwp_namespace.fluid_images.Spans ){
1454
- var imageHeight = this.listItemWidth / cwp_namespace.fluid_images.Spans[index].imageRatio;
1455
- jQuery(cwp_namespace.fluid_images.Spans[index].self).find( 'img' ).css({
1456
  height: imageHeight,
1457
  marginTop: -(imageHeight - spanHeight) / 2
1458
  });
@@ -1462,25 +1502,25 @@ function change_cropped_image_dimensions() {
1462
  },
1463
  }
1464
 
1465
- <?php
1466
- /***
1467
- * cpw_crop_widgets is an internal filter that is used
1468
- * to gather the ids of the widgets to which apply cropping
1469
- *
1470
- * For eaier prevention of duplication, the widget id number should be an index
1471
- * in the array while the ratio of width/height be the value
1472
- */
1473
- $widgets_ids = apply_filters('cpw_crop_widgets',array());
1474
- foreach ($widgets_ids as $number => $ratio) {
1475
- ?>
1476
  cwp_namespace.fluid_images.widget = jQuery('#<?php echo $number?>');
1477
- cwp_namespace.fluid_images.Posts['<?php echo $number?>'] = new cwp_namespace.fluid_images.WidgetPosts(cwp_namespace.fluid_images.widget,<?php echo $ratio?>);
1478
- <?php } ?>
1479
 
1480
  <?php /* do on page load or on resize the browser window */ echo "\r\n" ?>
1481
  jQuery(window).on('load resize', function() {
1482
- for (var post in cwp_namespace.fluid_images.Posts) {
1483
- cwp_namespace.fluid_images.Posts[post].changeImageSize();
1484
  }
1485
  });
1486
  });
@@ -1593,13 +1633,14 @@ function default_settings() {
1593
  'title' => '',
1594
  'title_link' => false,
1595
  'hide_title' => false,
1596
- 'cat' => '',
1597
  'num' => get_option('posts_per_page'),
1598
  'offset' => 1,
1599
  'sort_by' => 'date',
1600
  'asc_sort_order' => false,
1601
  'exclude_current_post' => false,
1602
  'hideNoThumb' => false,
 
1603
  'footer_link' => '',
1604
  'thumb' => false,
1605
  'thumbTop' => false,
@@ -1618,6 +1659,7 @@ function default_settings() {
1618
  'date_link' => false,
1619
  'date_format' => '',
1620
  'disable_css' => false,
 
1621
  'hide_if_empty' => false,
1622
  'hide_social_buttons' => '',
1623
  'no_cat_childs' => false,
@@ -1718,7 +1760,6 @@ function customize_register($wp_customize) {
1718
 
1719
  foreach($posts as $p) {
1720
  $widget = new Widget();
1721
- $widget->number = $p->ID;
1722
  $meta = get_post_meta($p->ID,SHORTCODE_META,true);
1723
  if (!is_array($meta))
1724
  continue;
@@ -1748,9 +1789,10 @@ function customize_register($wp_customize) {
1748
  ) );
1749
 
1750
  ob_start();
 
1751
  $widget->form($m);
1752
  $form = ob_get_clean();
1753
- $form = preg_replace_callback('/<(input|select)\s+.*name=("|\').*\[\d*\]\[([^\]]*)\][^>]*>/',
1754
  function ($matches) use ($p, $wp_customize, $m, $k) {
1755
  $setting = '_virtual-'.WIDGET_BASE_ID.'['.$p->ID.']['.$k.']['.$matches[3].']';
1756
  if (!isset($m[$matches[3]]))
@@ -2058,44 +2100,40 @@ class virtualWidget {
2058
  *
2059
  * @since 4.7
2060
  */
2061
- function getCSSRules($is_shortcode,&$ret) {
2062
- $rules = array( // rules that should be applied to all widgets
2063
- '.cat-post-item span.cat-post-css-cropping img {max-width: initial; max-height: initial;}',
2064
- '.cat-post-title {display: inline-block; font-size: 15px;}',
2065
- '.cat-post-current .cat-post-title {font-weight: bold; text-transform: uppercase;}'.
2066
- '.cat-post-date {font-size: 12px; line-height: 18px; font-style: italic; margin-bottom: 10px;}',
2067
- '.cat-post-comment-num {font-size: 12px; line-height: 18px;}',
2068
- '.cat-post-author {margin-bottom: 0;}',
2069
- '.cat-post-thumbnail {display: block;}',
2070
- '.cat-post-thumbnail img {margin: 5px 10px 5px 0;}',
2071
- '.cat-post-item:before {content: ""; display: table; clear: both;}',
2072
- '.cat-post-item:after {content: ""; display: table; clear: both;}',
2073
- '.cat-post-item .cat-post-css-cropping span {margin: 5px 10px 5px 0; overflow: hidden; display:inline-block}',
2074
- '.cat-post-item .cat-post-css-cropping img {margin: initial;}',
2075
- /* White, Dark, Scale, Blur */
2076
- '.cat-post-white img {padding-bottom: 0 !important; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease;}',
2077
- '.cat-post-dark img {padding-bottom: 0 !important; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease;}',
2078
- '.cat-post-scale img {padding-bottom: 0 !important; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease;}',
2079
- '.cat-post-blur img {padding-bottom: 0 !important; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease;}',
2080
- /* White */
2081
- '.cat-post-white {background-color: white;}',
2082
- '.cat-post-white img:hover {opacity: 0.8;}',
2083
- /* Dark */
2084
- '.cat-post-dark img:hover {-webkit-filter: brightness(75%); -moz-filter: brightness(75%); -ms-filter: brightness(75%); -o-filter: brightness(75%); filter: brightness(75%);}',
2085
- /* Scale */
2086
- '.cat-post-scale span {overflow: hidden; margin: 5px 10px 5px 0;}',
2087
- '.cat-post-scale img {margin: initial; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease;}',
2088
- '.cat-post-scale img:hover {-webkit-transform: scale(1.1, 1.1); -ms-transform: scale(1.1, 1.1); transform: scale(1.1, 1.1);}',
2089
- '.cat-post-blur img:hover {-webkit-filter: blur(2px); -moz-filter: blur(2px); -o-filter: blur(2px); -ms-filter: blur(2px); filter: blur(2px);}',
2090
- );
2091
-
2092
  $settings = self::$collection[$this->id];
2093
  $widget_id = $this->id;
2094
  if (!$is_shortcode)
2095
  $widget_id .= '-internal';
2096
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2097
  if (!(isset($settings['disable_css']) && $settings['disable_css'])) { // checks if css disable is not set
2098
-
2099
  /*
2100
  the twenty seventeen theme have a border between the LI elements of a widget,
2101
  so remove our border if we detect its use to avoid conflicting styling
@@ -2106,27 +2144,58 @@ class virtualWidget {
2106
  $rules[] = '.cat-post-item {border-bottom: 1px solid #ccc; list-style: none; list-style-type: none; margin: 3px 0; padding: 3px 0;}';
2107
  $rules[] = '.cat-post-item:last-child {border-bottom: none;}';
2108
  }
 
2109
  if (!(isset($settings['thumbTop']) && $settings['thumbTop'])) {
2110
  $rules[] = '.cat-post-thumbnail {float:left;}';
2111
  }
2112
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2113
  foreach ($rules as $rule) {
2114
  $ret[] = '#'.$widget_id.' '.$rule;
2115
  }
2116
-
2117
  if ($is_shortcode) {
2118
- // 2016 theme adds underlines to links with box whadow wtf....
2119
- $ret[] = '#'.$widget_id.' .cat-post-thumbnail a {box-shadow:none}'; // this for the thumb link
2120
- // 2015 adds border....
2121
- $ret[] = '#'.$widget_id.' .cat-post-thumbnail a {border:0}'; // this for the thumb link
2122
-
2123
- // probably all theme have too much margin on their p element when used in the shortcode
2124
- $ret[] = '#'.$widget_id.' p {margin:5px 0 0 0}'; // since on bottom it will make the spacing on cover
2125
- // bigger (add to the padding) use only top for now
2126
  }
2127
- }
 
 
 
 
 
2128
  }
2129
-
2130
  /**
2131
  * Output the widget CSS
2132
  *
4
  Plugin URI: https://wordpress.org/plugins/category-posts/
5
  Description: Adds a widget that shows the most recent posts from a single category.
6
  Author: TipTopPress
7
+ Version: 4.7.2
8
  Author URI: http://tiptoppress.com
9
  Text Domain: category-posts
10
  Domain Path: /languages
15
  // Don't call the file directly
16
  if ( !defined( 'ABSPATH' ) ) exit;
17
 
18
+ const CAT_POST_VERSION = "4.7.2";
19
  const CAT_POST_DOC_URL = "http://tiptoppress.com/category-posts-widget/documentation-4-7?utm_source=widget_cpw&utm_campaign=documentation_4_7_cpw&utm_medium=form";
20
 
21
  const SHORTCODE_NAME = 'catposts';
230
  }
231
  .category-widget-cont > div {
232
  display:none;
 
233
  }
234
  .category-widget-cont > div.open {
235
  display:block;
338
  .'px;clip:rect(auto,'.($this->instance['thumb_w']+$image['marginVal']).'px,auto,'.$image['marginVal']
339
  .'px);width:auto;max-width:initial;" ',$html);
340
  // wrap span
341
+ $html = '<span class="cat-post-crop" style="width:'.$this->instance['thumb_w'].'px;height:'.$this->instance['thumb_h'].'px;">'
342
  .$html.'</span>';
343
  } else {
344
  // use_css_cropping is not used
398
  * Excerpt more link filter
399
  */
400
  function excerpt_more_filter($more) {
401
+ return ' <a class="cat-post-excerpt-more more-link" href="'. get_permalink() . '">' . esc_html($this->instance["excerpt_more_text"]) . '</a>';
402
  }
403
 
404
  /**
489
 
490
  if ( isset( $instance["thumb"] ) && $instance["thumb"] &&
491
  ((isset($instance['default_thunmbnail']) && ($instance['default_thunmbnail']!= 0)) || has_post_thumbnail()) ) {
492
+
493
+ $class = '';
494
+ $use_css_cropping = isset($this->instance['use_css_cropping']) && $this->instance['use_css_cropping'];
495
+ $disable_css = !(isset($this->instance['disable_css']) && $this->instance['disable_css']);
496
+
497
+ if( $use_css_cropping || $disable_css) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
498
  if( isset($this->instance['thumb_hover'] )) {
499
+ $class = "class=\"cat-post-thumbnail cat-post-" . $instance['thumb_hover'] . "\"";
500
  } else {
501
+ $class = "class=\"cat-post-thumbnail\"";
502
  }
503
+ }
504
+
505
  $title_args = array('echo'=>false);
506
+
507
  if ($no_link)
508
  $ret .= '<span '.$class . '">';
509
  else
510
  $ret .= '<a '.$class . ' href="'.get_the_permalink().'" title="'.the_title_attribute($title_args).'">';
511
+
512
  $ret .= $this->the_post_thumbnail( array($this->instance['thumb_w'],$this->instance['thumb_h']));
513
+
514
  if ($no_link)
515
  $ret .= '</span>';
516
  else
622
  } else
623
  $ret .= $title;
624
 
625
+ $ret .= $after_title;
626
+ }
627
+
628
+ return $ret;
629
+ }
630
+
631
  /**
632
  * Calculate the HTML of the footer based on the widget settings
633
  *
636
  *
637
  * @since 4.6
638
  */
639
+ function footerHTML($instance) {
640
+
641
+ $ret = "";
642
+ if (isset ( $instance["footer_link"] ) && !empty ( $instance["footer_link"] )) {
643
+ if (empty($instance["footer_link_text"]))
644
+ $instance["footer_link_text"] = $instance["footer_link"];
645
  $ret = "<a";
646
  if( !(isset( $instance['disable_css'] ) && $instance['disable_css'])) {
647
  $ret.= " class=\"cat-post-footer-link\"";
648
  }
649
  if (isset($instance["cat"]) && ($instance["cat"] != 0) && (get_category($instance["cat"]) != null) ) {
650
+ $ret .= " href=\"" . get_category_link($instance["cat"]) . "\">" . esc_html($instance["footer_link_text"]) . "</a>";
651
  } else {
652
  // link to posts page if category not found.
653
  // this maybe the blog page or home page
654
+ if( isset ( $instance["footer_link"] ) && !empty ( $instance["footer_link"] ) ) {
655
+ $ret .= " href=\"" . esc_url($instance["footer_link"]) . "\">" . esc_html($instance["footer_link_text"]) . "</a>";
656
+ } else {
657
+ $blog_page = get_option('page_for_posts');
658
+ if ($blog_page)
659
+ $ret .= " href=\"" . get_permalink($blog_page) . "\">" . esc_html($instance["footer_link_text"]) . "</a>";
660
+ else
661
+ $ret .= " href=\"" . home_url() . "\">" . esc_html($instance["footer_link_text"]) . "</a>";
662
+ }
663
  }
664
  }
665
+ return $ret;
666
+ }
667
+
 
 
668
  /**
669
  * Calculate the HTML for a post item based on the widget settings and post.
670
  * Expected to be called in an active loop with all the globals set
680
  global $post;
681
 
682
  $everything_is_link = isset( $instance['everything_is_link'] ) && $instance['everything_is_link'];
683
+ $disable_css = isset($instance['disable_css']) && $instance['disable_css'];
684
 
685
  $ret = '<li ';
686
 
693
  $ret.='>'; // close the li opening tag
694
 
695
  if ($everything_is_link) {
696
+ $ret .= '<a class="cat-post-everything-is-link" href="'.get_the_permalink().'" title="">';
697
  }
698
+
699
  // Thumbnail position to top
700
  if( isset( $instance["thumbTop"] ) && $instance["thumbTop"]) {
701
  $ret .= $this->show_thumb($instance,$everything_is_link);
707
  $ret .= '<span class="cat-post-title">'.get_the_title().'</span>';
708
  } else {
709
  $ret .= '<a class="post-title';
710
+ if (!$disable_css) {
711
  $ret .= " cat-post-title";
712
  }
713
  $ret .= '" href="'.get_the_permalink().'" rel="bookmark">'.get_the_title();
722
  } else {
723
  $date_format = "j M Y";
724
  }
725
+ $ret .= '<p class="post-date';
726
+ if (!$disable_css) {
727
+ $ret .= " cat-post-date";
728
  }
729
  $ret .= '">';
730
  if ( isset ( $instance["date_link"] ) && $instance["date_link"] && !$everything_is_link) {
731
  $ret .= '<a href="'.\get_the_permalink().'">';
732
  }
733
  $ret .= get_the_time($date_format);
734
+ if ( isset ( $instance["date_link"] ) && $instance["date_link"] && !$everything_is_link ) {
735
  $ret .= '</a>';
736
  }
737
  $ret .= '</p>';
754
  if (!isset($instance['excerpt_filters']) || $instance['excerpt_filters']) { // pre 4.7 widgets has filters on
755
  $excerpt = apply_filters('the_excerpt', \get_the_excerpt() );
756
  } else { // if filters off replicate functionality of core generating excerpt
757
+ if ($post->post_excerpt == '') {
758
+ $text = get_the_content('');
759
+ $text = strip_shortcodes( $text );
760
+ $more_text = '[&hellip;]';
761
+ if( isset($instance["excerpt_more_text"]) && $instance["excerpt_more_text"] )
762
+ $more_text = ltrim($instance["excerpt_more_text"]);
763
+
764
+ if ($everything_is_link)
765
+ $excerpt_more_text = ' <span class="cat-post-excerpt-more">'.$more_text.'</span>';
766
+ else
767
+ $excerpt_more_text = ' <a class="cat-post-excerpt-more" href="'. get_permalink() . '" title="'.sprintf(__('Continue reading %s'),get_the_title()).'">' . $more_text . '</a>';
768
+ $excerpt = \wp_trim_words( $text, $length, $excerpt_more_text );
769
+ // adjust html output same way as for the normal excerpt,
770
+ // just force all functions depending on the_excerpt hook
771
+ $excerpt = shortcode_unautop(wpautop(convert_chars(convert_smilies(wptexturize($excerpt)))));
772
+ } else {
773
+ $excerpt = shortcode_unautop(wpautop(convert_chars(convert_smilies(wptexturize($post->post_excerpt)))));
774
+ }
775
  }
776
  $ret .= apply_filters('cpw_excerpt',$excerpt);
777
  }
779
  // Comments
780
  if ( isset( $instance['comment_num'] ) && $instance['comment_num']) {
781
  $ret .= '<p class="comment-num';
782
+ if (!$disable_css) {
783
  $ret .= " cat-post-comment-num";
784
  }
785
  $ret .= '">';
789
 
790
  // Author
791
  if ( isset( $instance['author'] ) && $instance['author']) {
792
+ $ret .= '<p class="post-author';
793
+ if (!$disable_css) {
794
+ $ret .= " cat-post-author";
795
  }
796
  $ret .= '">';
797
  global $authordata;
808
  }
809
  $ret .= '</p>';
810
  }
811
+
812
+ if ($everything_is_link) {
813
+ $ret .= '</a>';
814
+ }
815
 
816
  $ret .= '</li>';
817
  return $ret;
927
  $this->removeExcerpFilters($instance);
928
 
929
  wp_reset_postdata();
930
+
931
+ $use_css_cropping = isset($this->instance['use_css_cropping']) && $this->instance['use_css_cropping'];
932
+
933
+ if ($use_css_cropping){
934
+ // enque relevant scripts and parameters to perform cropping
935
+ // once we support only 4.5+ it can be refactored to use wp_add_inline_script
936
+ wp_enqueue_script( 'jquery'); // just in case the theme or other plugins didn't enqueue it
937
+ add_action('wp_footer', __NAMESPACE__.'\change_cropped_image_dimensions', 100); // add to the footer the cropping script
938
+ $number = $this->number;
939
+ // a temporary hack to handle difference in the number in a true widget
940
+ // and the number format expected at the rest of the places
941
+ if (is_numeric($number))
942
+ $number = WIDGET_BASE_ID .'-'.$number;
943
+
944
+ // add Javascript to change change cropped image dimensions on load and window resize
945
+ $thumb_w = $this->instance['thumb_w'];
946
+ $thumb_h = $this->instance['thumb_h'];
947
+ add_filter('cpw_crop_widgets', function ($a) use ($number, $thumb_w, $thumb_h) {
948
+ $a[$number] = $thumb_w / $thumb_h;
949
+ return $a;
950
+ });
951
+ }
952
  }
953
  }
954
 
1019
  */
1020
  function formFilterPanel($instance) {
1021
  $instance = wp_parse_args( ( array ) $instance, array(
1022
+ 'cat' => 0,
1023
  'num' => get_option('posts_per_page'),
1024
  'offset' => 1,
1025
  'sort_by' => '',
1042
  <p>
1043
  <label>
1044
  <?php _e( 'Category','category-posts' ); ?>:
1045
+ <?php wp_dropdown_categories( array( 'show_option_all' => __('All categories','category-posts'), 'hide_empty'=> 0, 'name' => $this->get_field_name("cat"), 'selected' => $instance["cat"], 'class' => 'categoryposts-data-panel-filter-cat' ) ); ?>
1046
  </label>
1047
  </p>
1048
  <p>
1059
  </p>
1060
  <p>
1061
  <label for="<?php echo $this->get_field_id("offset"); ?>">
1062
+ <?php _e('Start with post','category-posts'); ?>:
1063
  <input style="text-align: center; width: 30%;" id="<?php echo $this->get_field_id("offset"); ?>" name="<?php echo $this->get_field_name("offset"); ?>" type="number" min="1" value="<?php echo absint($instance["offset"]); ?>" />
1064
  </label>
1065
  </p>
1138
  </p>
1139
  <p>
1140
  <label>
1141
+ <?php _e('Thumbnail dimensions (in pixels)','category-posts'); ?><br />
1142
  <label for="<?php echo $this->get_field_id("thumb_w"); ?>">
1143
  <?php _e('Width:','category-posts')?> <input class="widefat" style="width:30%;" type="number" min="1" id="<?php echo $this->get_field_id("thumb_w"); ?>" name="<?php echo $this->get_field_name("thumb_w"); ?>" value="<?php echo esc_attr($instance["thumb_w"]); ?>" />
1144
  </label>
1153
  <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("use_css_cropping"); ?>" name="<?php echo $this->get_field_name("use_css_cropping"); ?>"<?php checked( (bool) $instance["use_css_cropping"], true ); ?> />
1154
  <?php _e( 'CSS crop to requested size ','category-posts' ); ?>
1155
  </label>
1156
+ </p>
1157
+ <p>
1158
+ <label for="<?php echo $this->get_field_id("thumb_hover"); ?>">
1159
+ <?php _e( 'Animation on mouse hover:','category-posts' ); ?>
1160
+ </label>
1161
+ <select id="<?php echo $this->get_field_id("thumb_hover"); ?>" name="<?php echo $this->get_field_name("thumb_hover"); ?>">
1162
+ <option value="none" <?php selected($thumb_hover, 'none')?>><?php _e( 'None', 'category-posts' ); ?></option>
1163
+ <option value="dark" <?php selected($thumb_hover, 'dark')?>><?php _e( 'Darker', 'category-posts' ); ?></option>
1164
+ <option value="white" <?php selected($thumb_hover, 'white')?>><?php _e( 'Brighter', 'category-posts' ); ?></option>
1165
+ <option value="scale" <?php selected($thumb_hover, 'scale')?>><?php _e( 'Zoom in', 'category-posts' ); ?></option>
1166
+ <option value="blur" <?php selected($thumb_hover, 'blur')?>><?php _e( 'Blur', 'category-posts' ); ?></option>
1167
+ </select>
1168
+ </p>
1169
  <p>
1170
  <label style="display:block">
1171
+ <?php _e( 'Default thumbnail: ','category-posts' ); ?>
1172
  </label>
1173
  <input type="hidden" class="default_thumb_id" id="<?php echo $this->get_field_id("default_thunmbnail"); ?>" name="<?php echo $this->get_field_name("default_thunmbnail"); ?>" value="<?php echo esc_attr($default_thunmbnail)?>"/>
1174
  <span class="default_thumb_img">
1190
  <?php _e('No default','category-posts')?>
1191
  </button>
1192
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
1193
  </div>
1194
  <?php
1195
  }
1209
  }
1210
  $instance = wp_parse_args( ( array ) $instance, array(
1211
  'everything_is_link' => false,
1212
+ 'footer_link_text' => '',
1213
  'footer_link' => '',
1214
  'hide_post_titles' => '',
1215
  'excerpt' => '',
1222
  'date_link' => '',
1223
  'date_format' => '',
1224
  'disable_css' => '',
1225
+ 'disable_font_styles' => '',
1226
  'hide_if_empty' => '',
1227
  'hide_social_buttons' => '',
1228
  ) );
1229
 
1230
  $everything_is_link = $instance['everything_is_link'];
1231
+ $footer_link_text = $instance['footer_link_text'];
1232
  $footer_link = $instance['footer_link'];
1233
  $hide_post_titles = $instance['hide_post_titles'];
1234
  $excerpt = $instance['excerpt'];
1241
  $date_link = $instance['date_link'];
1242
  $date_format = $instance['date_format'];
1243
  $disable_css = $instance['disable_css'];
1244
+ $disable_font_styles = $instance['disable_font_styles'];
1245
  $hide_if_empty = $instance['hide_if_empty'];
1246
+
1247
+ $cat = $instance['cat'];
1248
 
1249
 
1250
  if (!isset($style_done)) { // what an ugly hack, but can't figure out how to do it nicer on 4.3
1320
  <p>
1321
  <label for="<?php echo $this->get_field_id("excerpt_filters"); ?>">
1322
  <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("excerpt_filters"); ?>" name="<?php echo $this->get_field_name("excerpt_filters"); ?>"<?php checked( !empty($excerpt_filters), true ); ?> />
1323
+ <?php _e( 'Don\'t override Themes and plugin filters','category-posts' ); ?>
1324
  </label>
1325
  </p>
1326
  </div>
1359
  </div>
1360
  <h4 data-panel="general"><?php _e('General','category-posts')?></h4>
1361
  <div>
1362
+ <p onchange="javascript:cwp_namespace.toggleDisableFontStyles(this)">
1363
  <label for="<?php echo $this->get_field_id("disable_css"); ?>">
1364
  <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("disable_css"); ?>" name="<?php echo $this->get_field_name("disable_css"); ?>"<?php checked( (bool) $instance["disable_css"], true ); ?> />
1365
  <?php _e( 'Disable the built-in CSS for this widget','category-posts' ); ?>
1366
  </label>
1367
  </p>
1368
+ <p class="categoryposts-data-panel-general-disable-font-styles" style="display:<?php echo ((bool) $disable_css) ? 'none' : 'block'?>">
1369
+ <label for="<?php echo $this->get_field_id("disable_font_styles"); ?>">
1370
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("disable_font_styles"); ?>" name="<?php echo $this->get_field_name("disable_font_styles"); ?>"<?php checked( (bool) $instance["disable_font_styles"], true ); ?> />
1371
+ <?php _e( 'Disable only font styles for this widget','category-posts' ); ?>
1372
+ </label>
1373
+ </p>
1374
  <p>
1375
  <label for="<?php echo $this->get_field_id("hide_if_empty"); ?>">
1376
  <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("hide_if_empty"); ?>" name="<?php echo $this->get_field_name("hide_if_empty"); ?>"<?php checked( (bool) $instance["hide_if_empty"], true ); ?> />
1381
  <h4 data-panel="footer"><?php _e('Footer','category-posts')?></h4>
1382
  <div>
1383
  <p>
1384
+ <label for="<?php echo $this->get_field_id("footer_link_text"); ?>">
1385
  <?php _e( 'Footer link text','category-posts' ); ?>:
1386
+ <input class="widefat" style="width:60%;" placeholder="<?php _e('... more by this topic','category-posts')?>" id="<?php echo $this->get_field_id("footer_link_text"); ?>" name="<?php echo $this->get_field_name("footer_link_text"); ?>" type="text" value="<?php echo esc_attr($instance["footer_link_text"]); ?>" />
1387
  </label>
1388
  </p>
1389
+ <p class="categoryposts-data-panel-footer-footerLink" style="display:<?php echo ((bool) $cat == 0) ? 'block' : 'none'?>">
1390
+ <label for="<?php echo $this->get_field_id("footer_link"); ?>">
1391
+ <?php _e( 'Footer link URL','category-posts' ); ?>:
1392
+ <input class="widefat" style="width:60%;" placeholder="<?php _e('... URL of more link','category-posts')?>" id="<?php echo $this->get_field_id("footer_link"); ?>" name="<?php echo $this->get_field_name("footer_link"); ?>" type="text" value="<?php echo esc_attr($instance["footer_link"]); ?>" />
1393
+ </label>
1394
+ </p>
1395
  </div>
1396
  <p><a href="<?php echo get_edit_user_link().'#'.__NAMESPACE__ ?>"><?php _e('Widget admin behaviour settings','category-posts')?></a></p>
1397
  <p><a target="_blank" href="<?php echo CAT_POST_DOC_URL ?>"><?php _e('Documentation','category-posts'); ?></a></p>
1451
  cwp_namespace.fluid_images = {
1452
 
1453
  <?php /* variables */ ?>
1454
+ Widgets : {},
1455
  widget : null,
 
1456
 
1457
  <?php /* class */ ?>
1458
  Span : function (_self, _imageRatio) {
1466
  WidgetPosts : function (widget, ratio) {
1467
 
1468
  <?php /* variables */ ?>
1469
+ this.Spans = {};
1470
+ this.allSpans = widget.find( '.cat-post-crop' );
1471
  this.firstSpan = this.allSpans.first();
1472
  this.maxSpanWidth = this.firstSpan.width();
1473
  this.firstListItem = this.firstSpan.closest( 'li' );
1475
 
1476
  for( var i = 0; i < this.allSpans.length; i++ ){
1477
  var imageRatio = this.firstSpan.width() / jQuery(this.allSpans[i]).find( 'img' ).height();
1478
+ this.Spans[i] = new cwp_namespace.fluid_images.Span( jQuery(this.allSpans[i]), imageRatio );
1479
  }
1480
 
1481
  <?php /* functions */ ?>
1490
  var spanHeight = this.listItemWidth / this.ratio;
1491
  this.allSpans.height( spanHeight );
1492
 
1493
+ for( var index in this.Spans ){
1494
+ var imageHeight = this.listItemWidth / this.Spans[index].imageRatio;
1495
+ jQuery(this.Spans[index].self).find( 'img' ).css({
1496
  height: imageHeight,
1497
  marginTop: -(imageHeight - spanHeight) / 2
1498
  });
1502
  },
1503
  }
1504
 
1505
+ <?php
1506
+ /***
1507
+ * cpw_crop_widgets is an internal filter that is used
1508
+ * to gather the ids of the widgets to which apply cropping
1509
+ *
1510
+ * For eaier prevention of duplication, the widget id number should be an index
1511
+ * in the array while the ratio of width/height be the value
1512
+ */
1513
+ $widgets_ids = apply_filters('cpw_crop_widgets',array());
1514
+ foreach ($widgets_ids as $number => $ratio) {
1515
+ ?>
1516
  cwp_namespace.fluid_images.widget = jQuery('#<?php echo $number?>');
1517
+ cwp_namespace.fluid_images.Widgets['<?php echo $number?>'] = new cwp_namespace.fluid_images.WidgetPosts(cwp_namespace.fluid_images.widget,<?php echo $ratio?>);
1518
+ <?php } ?>
1519
 
1520
  <?php /* do on page load or on resize the browser window */ echo "\r\n" ?>
1521
  jQuery(window).on('load resize', function() {
1522
+ for (var widget in cwp_namespace.fluid_images.Widgets) {
1523
+ cwp_namespace.fluid_images.Widgets[widget].changeImageSize();
1524
  }
1525
  });
1526
  });
1633
  'title' => '',
1634
  'title_link' => false,
1635
  'hide_title' => false,
1636
+ 'cat' => 0,
1637
  'num' => get_option('posts_per_page'),
1638
  'offset' => 1,
1639
  'sort_by' => 'date',
1640
  'asc_sort_order' => false,
1641
  'exclude_current_post' => false,
1642
  'hideNoThumb' => false,
1643
+ 'footer_link_text' => '',
1644
  'footer_link' => '',
1645
  'thumb' => false,
1646
  'thumbTop' => false,
1659
  'date_link' => false,
1660
  'date_format' => '',
1661
  'disable_css' => false,
1662
+ 'disable_font_styles' => false,
1663
  'hide_if_empty' => false,
1664
  'hide_social_buttons' => '',
1665
  'no_cat_childs' => false,
1760
 
1761
  foreach($posts as $p) {
1762
  $widget = new Widget();
 
1763
  $meta = get_post_meta($p->ID,SHORTCODE_META,true);
1764
  if (!is_array($meta))
1765
  continue;
1789
  ) );
1790
 
1791
  ob_start();
1792
+ $widget->number = $p->ID.'_'.$k;
1793
  $widget->form($m);
1794
  $form = ob_get_clean();
1795
+ $form = preg_replace_callback('/<(input|select)\s+.*name=("|\').*\[\w*\]\[([^\]]*)\][^>]*>/',
1796
  function ($matches) use ($p, $wp_customize, $m, $k) {
1797
  $setting = '_virtual-'.WIDGET_BASE_ID.'['.$p->ID.']['.$k.']['.$matches[3].']';
1798
  if (!isset($m[$matches[3]]))
2100
  *
2101
  * @since 4.7
2102
  */
2103
+ function getCSSRules($is_shortcode,&$ret) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2104
  $settings = self::$collection[$this->id];
2105
  $widget_id = $this->id;
2106
  if (!$is_shortcode)
2107
  $widget_id .= '-internal';
2108
+
2109
+ if (!(isset($settings['disable_font_styles']) && $settings['disable_font_styles'])) { // checks if disable font styles is not set
2110
+ $rules = array( // rules that should be applied to all widgets
2111
+ '.cat-post-item img {max-width: initial; max-height: initial;}',
2112
+ '.cat-post-title {font-size: 15px;}',
2113
+ '.cat-post-current .cat-post-title {font-weight: bold; text-transform: uppercase;}',
2114
+ '.cat-post-date {font-size: 12px; line-height: 18px; font-style: italic; margin-bottom: 10px;}',
2115
+ '.cat-post-comment-num {font-size: 12px; line-height: 18px;}',
2116
+ '.cat-post-author {margin-bottom: 0;}',
2117
+ '.cat-post-thumbnail {margin: 5px 10px 5px 0; display: block;}',
2118
+ '.cat-post-item:before {content: ""; display: table; clear: both;}',
2119
+ '.cat-post-item:after {content: ""; display: table; clear: both;}',
2120
+ '.cat-post-item img {margin: initial;}',
2121
+ );
2122
+ } else {
2123
+ $rules = array( // rules that should be applied to all widgets
2124
+ '.cat-post-item img {max-width: initial; max-height: initial;}',
2125
+ '.cat-post-current .cat-post-title {text-transform: uppercase;}',
2126
+ '.cat-post-date {margin-bottom: 10px;}',
2127
+ '.cat-post-author {margin-bottom: 0;}',
2128
+ '.cat-post-thumbnail {margin: 5px 10px 5px 0; display: block;}',
2129
+ '.cat-post-item:before {content: ""; display: table; clear: both;}',
2130
+ '.cat-post-item:after {content: ""; display: table; clear: both;}',
2131
+ '.cat-post-item img {margin: initial;}',
2132
+ );
2133
+ }
2134
+
2135
  if (!(isset($settings['disable_css']) && $settings['disable_css'])) { // checks if css disable is not set
2136
+
2137
  /*
2138
  the twenty seventeen theme have a border between the LI elements of a widget,
2139
  so remove our border if we detect its use to avoid conflicting styling
2144
  $rules[] = '.cat-post-item {border-bottom: 1px solid #ccc; list-style: none; list-style-type: none; margin: 3px 0; padding: 3px 0;}';
2145
  $rules[] = '.cat-post-item:last-child {border-bottom: none;}';
2146
  }
2147
+
2148
  if (!(isset($settings['thumbTop']) && $settings['thumbTop'])) {
2149
  $rules[] = '.cat-post-thumbnail {float:left;}';
2150
  }
2151
+
2152
+ if (isset($settings['thumb_hover'])) {
2153
+ switch ($settings['thumb_hover']) {
2154
+ case 'white':
2155
+ $rules[] = '.cat-post-white img {padding-bottom: 0 !important; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease;}';
2156
+ $rules[] = '.cat-post-white {background-color: white;}';
2157
+ $rules[] = '.cat-post-white img:hover {opacity: 0.8;}';
2158
+ break;
2159
+ case 'dark':
2160
+ $rules[] = '.cat-post-dark img {padding-bottom: 0 !important; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease;}';
2161
+ $rules[] = '.cat-post-dark img:hover {-webkit-filter: brightness(75%); -moz-filter: brightness(75%); -ms-filter: brightness(75%); -o-filter: brightness(75%); filter: brightness(75%);}';
2162
+ break;
2163
+ case 'scale':
2164
+ $rules[] = '.cat-post-scale img {margin: initial; padding-bottom: 0 !important; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease;}';
2165
+ $rules[] = '.cat-post-scale img:hover {-webkit-transform: scale(1.1, 1.1); -ms-transform: scale(1.1, 1.1); transform: scale(1.1, 1.1);}';
2166
+ break;
2167
+ case 'blur':
2168
+ $rules[] = '.cat-post-blur img {padding-bottom: 0 !important; -webkit-transition: all 0.3s ease; -moz-transition: all 0.3s ease; -ms-transition: all 0.3s ease; -o-transition: all 0.3s ease; transition: all 0.3s ease;}';
2169
+ $rules[] = '.cat-post-blur img:hover {-webkit-filter: blur(2px); -moz-filter: blur(2px); -o-filter: blur(2px); -ms-filter: blur(2px); filter: blur(2px);}';
2170
+ break;
2171
+ }
2172
+ }
2173
+
2174
+ if (isset( $settings['everything_is_link'] ) && $settings['everything_is_link']) {
2175
+ $rules[] = '.cat-post-everything-is-link { }';
2176
+ }
2177
+
2178
  foreach ($rules as $rule) {
2179
  $ret[] = '#'.$widget_id.' '.$rule;
2180
  }
2181
+
2182
  if ($is_shortcode) {
2183
+ // Twenty Sixteen Theme adds underlines to links with box whadow wtf ...
2184
+ $ret[] = '#'.$widget_id.' .cat-post-thumbnail {box-shadow:none}'; // this for the thumb link
2185
+ // Twenty Fifteen Theme adds border ...
2186
+ $ret[] = '#'.$widget_id.' .cat-post-thumbnail {border:0}'; // this for the thumb link
2187
+ // probably all Themes have too much margin on their p element when used in the shortcode
2188
+ $ret[] = '#'.$widget_id.' p {margin:5px 0 0 0}'; /* since on bottom it will make the spacing on cover
2189
+ bigger (add to the padding) use only top for now */
 
2190
  }
2191
+ }
2192
+
2193
+ if ((isset($settings['use_css_cropping']) && $settings['use_css_cropping']) || !(isset($settings['disable_css']) && $settings['disable_css'])) {
2194
+ $ret[] = '#'.$widget_id.' .cat-post-crop {overflow: hidden; display:block}';
2195
+ $ret[] = '#'.$widget_id.' .cat-post-item img {margin: initial;}';
2196
+ }
2197
  }
2198
+
2199
  /**
2200
  * Output the widget CSS
2201
  *
js/admin/category-posts-widget.js CHANGED
@@ -1,150 +1,178 @@
1
- /**
2
- * Category Posts Widget
3
- * http://mkrdip.me/category-posts-widget
4
- *
5
- * Adds a widget that shows the most recent posts from a single category.
6
- *
7
- * Released under the GPLv2 license or later - http://www.gnu.org/licenses/gpl-2.0.html
8
- */
9
-
10
- // namespace
11
-
12
- var cwp_namespace = {
13
-
14
- open_panels : {}, // holds an array of open panels per wiget id
15
-
16
- // generic click handler on the panel title
17
- clickHandler: function(element) {
18
- // open the div "below" the h4 title
19
- jQuery(element).toggleClass('open')
20
- .next().stop().slideToggle();
21
- // mark the change of state in the open panels array
22
- var panel = jQuery(element).data('panel');
23
- var id = jQuery(element).parent().parent().parent().parent().parent().attr('id');
24
- var o = {};
25
- if (this.open_panels.hasOwnProperty(id))
26
- o = this.open_panels[id];
27
- if (o.hasOwnProperty(panel))
28
- delete o[panel];
29
- else
30
- o[panel] = true;
31
- this.open_panels[id] = o;
32
- },
33
-
34
- // Show hide excerpt options on excerpt option check box change
35
- toggleExcerptPanel: function(item) {
36
- var value = jQuery(item).find("input").attr('checked');
37
- var panel = item.parentElement.parentElement;
38
- var layout = jQuery(panel).find(".layout_select option:selected").attr('value');
39
- if(value == 'checked') {
40
- jQuery(panel).find('.categoryposts-data-panel-excerpt').show();
41
- }
42
- else {
43
- jQuery(panel).find('.categoryposts-data-panel-excerpt').hide();
44
- }
45
- },
46
-
47
- // Show hide date options on date option check box change
48
- toggleDatePanel: function(item) {
49
- var value = jQuery(item).find("input").attr('checked');
50
- var panel = item.parentElement.parentElement;
51
- var layout = jQuery(panel).find(".layout_select option:selected").attr('value');
52
- if(value == 'checked') {
53
- jQuery(panel).find('.categoryposts-data-panel-date').show();
54
- }
55
- else {
56
- jQuery(panel).find('.categoryposts-data-panel-date').hide();
57
- }
58
- },
59
-
60
- // Close all open panels if open
61
- autoCloseOpenPanels: function(_this) {
62
- if( categoryPosts.accordion ) {
63
- if(!jQuery(_this).hasClass('open')) {
64
- var jCloseElement = jQuery(_this).parent().find('.open');
65
- this.clickHandler(jCloseElement);
66
- }
67
- }
68
- },
69
-
70
- defaultThumbnailSelection: function (elem, title, button_title) {
71
-
72
- var frame = wp.media({
73
- title : title,
74
- multiple : false,
75
- library : { type : 'image' },
76
- button : { text : button_title },
77
- });
78
-
79
- // Handle results from media manager.
80
- frame.on('close',function( ) {
81
- var attachments = frame.state().get('selection').toJSON();
82
- if (attachments.length == 1) {
83
- var attachment = attachments[0];
84
- var img_html = '<img src="' + attachment.url + '" ';
85
- img_html += 'width="60" ';
86
- img_html += 'height="60" ';
87
- img_html += '/>';
88
- jQuery(elem).parent().prev().find('.default_thumb_img').html(img_html);
89
- jQuery(elem).parent().find('.cwp_default_thumb_remove').show();
90
- jQuery(elem).parent().prev().find('.default_thumb_id').val(attachment.id).change();
91
- }
92
- });
93
-
94
- frame.open();
95
- return false;
96
- },
97
-
98
- removeDefaultThumbnailSelection : function (elem) {
99
- jQuery(elem).parent().prev().find('.default_thumb_img').html(cwp_default_thumb_selection.none);
100
- jQuery(elem).hide();
101
- jQuery(elem).parent().prev().find('.default_thumb_id').val(0).change();
102
-
103
- return false;
104
- },
105
-
106
- }
107
-
108
- jQuery(document).ready( function () {
109
-
110
- jQuery('.category-widget-cont h4').click(function () { // for widgets page
111
- cwp_namespace.autoCloseOpenPanels(this);
112
- // toggle panel open/close
113
- cwp_namespace.clickHandler(this);
114
- });
115
-
116
- // needed to reassign click handlers after widget refresh
117
- jQuery(document).on('widget-added widget-updated', function(root,element){ // for customize and after save on widgets page
118
- jQuery('.category-widget-cont h4').off('click').on('click', function () {
119
- cwp_namespace.autoCloseOpenPanels(this);
120
- // toggle panel open/close
121
- cwp_namespace.clickHandler(this);
122
- });
123
- jQuery('.cwp_default_thumb_select').off('click').on('click', function () { // select default thumb
124
- cwp_namespace.defaultThumbnailSelection(this, cwp_default_thumb_selection.frame_title,cwp_default_thumb_selection.button_title);
125
- });
126
-
127
- jQuery('.cwp_default_thumb_remove').off('click').on('click', function () { // remove default thumb
128
- cwp_namespace.removeDefaultThumbnailSelection(this);
129
- });
130
- // refresh panels to state before the refresh
131
- var id = jQuery(element).attr('id');
132
- if (cwp_namespace.open_panels.hasOwnProperty(id)) {
133
- var o = cwp_namespace.open_panels[id];
134
- for (var panel in o) {
135
- jQuery(element).find('[data-panel='+panel+']').toggleClass('open')
136
- .next().stop().show();
137
- }
138
- }
139
- });
140
-
141
- jQuery('.cwp_default_thumb_select').off('click').on('click', function () { // select default thumb
142
- cwp_namespace.defaultThumbnailSelection(this, cwp_default_thumb_selection.frame_title,cwp_default_thumb_selection.button_title);
143
- });
144
-
145
- jQuery('.cwp_default_thumb_remove').off('click').on('click', function () { // remove default thumb
146
- cwp_namespace.removeDefaultThumbnailSelection(this);
147
- });
148
-
149
- });
150
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Category Posts Widget
3
+ * http://mkrdip.me/category-posts-widget
4
+ *
5
+ * Adds a widget that shows the most recent posts from a single category.
6
+ *
7
+ * Released under the GPLv2 license or later - http://www.gnu.org/licenses/gpl-2.0.html
8
+ */
9
+
10
+ // namespace
11
+
12
+ var cwp_namespace = {
13
+
14
+ open_panels : {}, // holds an array of open panels per wiget id
15
+
16
+ // generic click handler on the panel title
17
+ clickHandler: function(element) {
18
+ // open the div "below" the h4 title
19
+ jQuery(element).toggleClass('open')
20
+ .next().stop().slideToggle();
21
+ // mark the change of state in the open panels array
22
+ var panel = jQuery(element).data('panel');
23
+ var id = jQuery(element).parent().parent().parent().parent().parent().attr('id');
24
+ var o = {};
25
+ if (this.open_panels.hasOwnProperty(id))
26
+ o = this.open_panels[id];
27
+ if (o.hasOwnProperty(panel))
28
+ delete o[panel];
29
+ else
30
+ o[panel] = true;
31
+ this.open_panels[id] = o;
32
+ },
33
+
34
+ // Show hide excerpt options on excerpt option check box change
35
+ toggleExcerptPanel: function(item) {
36
+ var value = jQuery(item).find("input").attr('checked');
37
+ var panel = item.parentElement.parentElement;
38
+ var layout = jQuery(panel).find(".layout_select option:selected").attr('value');
39
+ if(value == 'checked') {
40
+ jQuery(panel).find('.categoryposts-data-panel-excerpt').show();
41
+ }
42
+ else {
43
+ jQuery(panel).find('.categoryposts-data-panel-excerpt').hide();
44
+ }
45
+ },
46
+
47
+ // Show hide date options on date option check box change
48
+ toggleDatePanel: function(item) {
49
+ var value = jQuery(item).find("input").attr('checked');
50
+ var panel = item.parentElement.parentElement;
51
+ var layout = jQuery(panel).find(".layout_select option:selected").attr('value');
52
+ if(value == 'checked') {
53
+ jQuery(panel).find('.categoryposts-data-panel-date').show();
54
+ }
55
+ else {
56
+ jQuery(panel).find('.categoryposts-data-panel-date').hide();
57
+ }
58
+ },
59
+
60
+ // Show hide foote link URL
61
+ toggleFooterLinkUrl: function(item) {
62
+ var cat = jQuery(item).find("option:selected").attr('value');
63
+ var panel = item.parentElement.parentElement.parentElement.parentElement;
64
+ if(cat == '0') {
65
+ jQuery(panel).find('.categoryposts-data-panel-footer-footerLink').show();
66
+ }
67
+ else {
68
+ jQuery(panel).find('.categoryposts-data-panel-footer-footerLink').hide();
69
+ }
70
+ },
71
+
72
+ // Show hide disable font styles
73
+ toggleDisableFontStyles: function(item) {
74
+ var value = jQuery(item).find("input").attr('checked');
75
+ var panel = item.parentElement.parentElement;
76
+ if(value == 'checked') {
77
+ jQuery(panel).find('.categoryposts-data-panel-general-disable-font-styles').hide();
78
+ }
79
+ else {
80
+ jQuery(panel).find('.categoryposts-data-panel-general-disable-font-styles').show();
81
+ }
82
+ },
83
+
84
+ // Close all open panels if open
85
+ autoCloseOpenPanels: function(_this) {
86
+ if( categoryPosts.accordion ) {
87
+ if(!jQuery(_this).hasClass('open')) {
88
+ var jCloseElement = jQuery(_this).parent().find('.open');
89
+ this.clickHandler(jCloseElement);
90
+ }
91
+ }
92
+ },
93
+
94
+ defaultThumbnailSelection: function (elem, title, button_title) {
95
+
96
+ var frame = wp.media({
97
+ title : title,
98
+ multiple : false,
99
+ library : { type : 'image' },
100
+ button : { text : button_title },
101
+ });
102
+
103
+ // Handle results from media manager.
104
+ frame.on('close',function( ) {
105
+ var attachments = frame.state().get('selection').toJSON();
106
+ if (attachments.length == 1) {
107
+ var attachment = attachments[0];
108
+ var img_html = '<img src="' + attachment.url + '" ';
109
+ img_html += 'width="60" ';
110
+ img_html += 'height="60" ';
111
+ img_html += '/>';
112
+ jQuery(elem).parent().prev().find('.default_thumb_img').html(img_html);
113
+ jQuery(elem).parent().find('.cwp_default_thumb_remove').show();
114
+ jQuery(elem).parent().prev().find('.default_thumb_id').val(attachment.id).change();
115
+ }
116
+ });
117
+
118
+ frame.open();
119
+ return false;
120
+ },
121
+
122
+ removeDefaultThumbnailSelection : function (elem) {
123
+ jQuery(elem).parent().prev().find('.default_thumb_img').html(cwp_default_thumb_selection.none);
124
+ jQuery(elem).hide();
125
+ jQuery(elem).parent().prev().find('.default_thumb_id').val(0).change();
126
+
127
+ return false;
128
+ },
129
+
130
+ }
131
+
132
+ jQuery(document).ready( function () {
133
+
134
+ jQuery('.category-widget-cont h4').click(function () { // for widgets page
135
+ cwp_namespace.autoCloseOpenPanels(this);
136
+ // toggle panel open/close
137
+ cwp_namespace.clickHandler(this);
138
+ });
139
+
140
+ // needed to reassign click handlers after widget refresh
141
+ jQuery(document).on('widget-added widget-updated', function(root,element){ // for customize and after save on widgets page
142
+ jQuery('.category-widget-cont h4').off('click').on('click', function () {
143
+ cwp_namespace.autoCloseOpenPanels(this);
144
+ // toggle panel open/close
145
+ cwp_namespace.clickHandler(this);
146
+ });
147
+ jQuery('.cwp_default_thumb_select').off('click').on('click', function () { // select default thumb
148
+ cwp_namespace.defaultThumbnailSelection(this, cwp_default_thumb_selection.frame_title,cwp_default_thumb_selection.button_title);
149
+ });
150
+
151
+ jQuery('.cwp_default_thumb_remove').off('click').on('click', function () { // remove default thumb
152
+ cwp_namespace.removeDefaultThumbnailSelection(this);
153
+ });
154
+ // refresh panels to state before the refresh
155
+ var id = jQuery(element).attr('id');
156
+ if (cwp_namespace.open_panels.hasOwnProperty(id)) {
157
+ var o = cwp_namespace.open_panels[id];
158
+ for (var panel in o) {
159
+ jQuery(element).find('[data-panel='+panel+']').toggleClass('open')
160
+ .next().stop().show();
161
+ }
162
+ }
163
+ });
164
+
165
+ jQuery('.cwp_default_thumb_select').off('click').on('click', function () { // select default thumb
166
+ cwp_namespace.defaultThumbnailSelection(this, cwp_default_thumb_selection.frame_title,cwp_default_thumb_selection.button_title);
167
+ });
168
+
169
+ jQuery('.cwp_default_thumb_remove').off('click').on('click', function () { // remove default thumb
170
+ cwp_namespace.removeDefaultThumbnailSelection(this);
171
+ });
172
+
173
+ jQuery('.categoryposts-data-panel-filter-cat').on('change', function () { // for widgets page
174
+ cwp_namespace.toggleFooterLinkUrl(this);
175
+ });
176
+
177
+ });
178
+
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mark-k, kometschuh, mkrdip
3
  Donate link: http://mkrdip.me/donate
4
  Tags: category, categories, posts, widget, posts widget, recent posts, category recent posts, shortcode, sidebar, excerpt, multiple widgets
5
  Requires at least: 2.8
6
- Tested up to: 4.7
7
- Stable tag: 4.7.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -22,33 +22,37 @@ We've also started creating free widget extensions for the Premium Widget. The f
22
  * Masonry (Responsive grid layouts)
23
  * Grid and Column full page layouts
24
  * Slider (Vertical and horizontal)
 
25
  * Categories, Custom Post Types, Taxonomies, Events, Products, ...
26
  * Full background post images
27
  * Mouse hover effects for post thumbnail
 
28
  * E-Mail support
29
  * All free features
30
- * More [examples on the demo pages](http://demo.tiptoppress.com/?utm_source=wordpress_org&utm_campaign=demo_cpw&utm_medium=web)
 
31
 
32
  = Features =
33
- * Shortcode (Easily change all Shortcode options in the customizer.)
34
- * Support multiple shortcodes
35
- * Add option for post offset (use two or more widgets after another)
36
- * Add insert shortcode buttons to the editor toolbar
 
37
  * For editing shortcode adds a Customizer link to the admin-bar ("With one click to the Customizer").
38
  * Option to show post thumbnail & set dimensions by width & height.
39
  * Option for <a target="_blank" href="http://tiptoppress.com/css-image-crop/?utm_source=wordpress_org&utm_campaign=features_crop_cpw&utm_medium=web">client-side cropped thumbnail dimensions</a> by width & height.
40
- * Fluid images for Responsive Layouts
41
  * Option to set mouse hover effects for post thumbnail.
42
- * Set a thumbnail as default thumbnail
43
- * Add option to enable excerpt filters from Themes and plugins
44
  * Jetpack 'Social buttons on posts' support.
45
- * Add option to disable social buttons, banner, ... in the excerpt
46
  * Option to change ordering of posts.
47
  * Set which category the posts should come form.
48
- * Add dropdownbox entry for 'all' categories
49
  * Set how many posts to show.
50
  * Option to hide widget, if category have currently no posts.
51
- * Add option to disable subcategories
52
  * Option to put thumbnail on top.
53
  * Option to hide posts which have no thumbnail.
54
  * Option exclude current post.
@@ -61,17 +65,16 @@ We've also started creating free widget extensions for the Premium Widget. The f
61
  * Option to make the widget date link to the category page.
62
  * Option to format the outputted date string.
63
  * Option to link to the category page below posts list.
64
- * Option to disable widget CSS.
65
  * Multiple widgets.
66
  * Multi sites support.
67
  * Support localization with translate.wordpress.org
68
- * Use WP user profile for settings ('auto close' and if the shortcode button appears in the editor toolbar)
69
 
70
  = Documentation =
71
  * Full documentation on [tiptoppress.com](http://tiptoppress.com/category-posts-widget/documentation-4-7/?utm_source=wordpress_org&utm_campaign=documentation_4_7_cpw&utm_medium=web)
72
  * Shortcode: Use [catposts] [in the content and edit options in the customizer](http://tiptoppress.com/use-shortcode-to-add-category-posts-widget-to-the-content/?utm_source=wordpress_org&utm_campaign=documentation_shortcode_cpw&utm_medium=web)
73
  * Formatting date and time: See <a target="_blank" href="https://codex.wordpress.org/Formatting_Date_and_Time">Formatting Date and Time</a>
74
- * Widget <a target="_blank" href="http://tiptoppress.com/category/widget-customization-and-filter-extensions/?utm_source=wordpress_org&utm_campaign=documentation_filter_cpw&utm_medium=web">customization and filter extensions</a>
75
 
76
  = Contribute =
77
  While using this plugin if you find any bug or any conflict, please submit an issue at
@@ -131,6 +134,17 @@ We know there are peopel how use PHP 5.2 [wordpress.org/about/stats](https://wor
131
  == Changelog ==
132
  [Read more on our blog ...](http://tiptoppress.com/category/category-posts-widget?utm_source=wordpress_org&utm_campaign=changelog_cpw&utm_medium=web)
133
 
 
 
 
 
 
 
 
 
 
 
 
134
  = 4.7.1 - December 20th 2016 =
135
  * Support multiple shortcodes in content
136
  * Add option for post offset (use two or more widgets after another)
@@ -158,7 +172,7 @@ We know there are peopel how use PHP 5.2 [wordpress.org/about/stats](https://wor
158
  = 4.1.9 - May 5th 2016 =
159
  * Fixed undefined constant.
160
 
161
- = 4.1.8 - May 03th 2016 =
162
  * Add mouse hover effects: blur
163
  * Add option to choose allowed HTML in the excerpt
164
  * Add Jetpack 'Sharing - Show buttons on posts' support
3
  Donate link: http://mkrdip.me/donate
4
  Tags: category, categories, posts, widget, posts widget, recent posts, category recent posts, shortcode, sidebar, excerpt, multiple widgets
5
  Requires at least: 2.8
6
+ Tested up to: 4.8
7
+ Stable tag: 4.7.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
22
  * Masonry (Responsive grid layouts)
23
  * Grid and Column full page layouts
24
  * Slider (Vertical and horizontal)
25
+ * More complex ways to filter (all, any, exclude, also childes, AND or just OR rule)
26
  * Categories, Custom Post Types, Taxonomies, Events, Products, ...
27
  * Full background post images
28
  * Mouse hover effects for post thumbnail
29
+ * <a target="_blank" href="http://tiptoppress.com/category/extensions/?utm_source=wordpress_org&utm_campaign=premium_features_extensions&utm_medium=web">Extensions</a>
30
  * E-Mail support
31
  * All free features
32
+ * Free trail on localhost
33
+ * More [examples on the demo pages](http://demo.tiptoppress.com/?utm_source=wordpress_org&utm_campaign=premium_features_demo&utm_medium=web)
34
 
35
  = Features =
36
+ * Shortcode (Easily change all Shortcode options in the customizer).
37
+ * Support multiple shortcodes at the same post.
38
+ * Add option for post offset (use two or more widgets after another).
39
+ * Add UI buttons in the editor toolbar to insert shortcode.
40
+ * Option to touch device friendly "everything is a link".
41
  * For editing shortcode adds a Customizer link to the admin-bar ("With one click to the Customizer").
42
  * Option to show post thumbnail & set dimensions by width & height.
43
  * Option for <a target="_blank" href="http://tiptoppress.com/css-image-crop/?utm_source=wordpress_org&utm_campaign=features_crop_cpw&utm_medium=web">client-side cropped thumbnail dimensions</a> by width & height.
44
+ * Fluid images for Responsive Layouts.
45
  * Option to set mouse hover effects for post thumbnail.
46
+ * Set a thumbnail as default thumbnail.
47
+ * Add option to enable excerpt filters from Themes and plugins.
48
  * Jetpack 'Social buttons on posts' support.
49
+ * Add option to disable social buttons, banner, ... in the excerpt.
50
  * Option to change ordering of posts.
51
  * Set which category the posts should come form.
52
+ * Add dropdownbox entry for 'all' categories.
53
  * Set how many posts to show.
54
  * Option to hide widget, if category have currently no posts.
55
+ * Add option to disable subcategories.
56
  * Option to put thumbnail on top.
57
  * Option to hide posts which have no thumbnail.
58
  * Option exclude current post.
65
  * Option to make the widget date link to the category page.
66
  * Option to format the outputted date string.
67
  * Option to link to the category page below posts list.
68
+ * Option to disable the widget CSS or more granular control of default styling with not apply the font styles.
69
  * Multiple widgets.
70
  * Multi sites support.
71
  * Support localization with translate.wordpress.org
72
+ * Use WP user profile for settings ('auto close' and if the shortcode button appears in the editor toolbar).
73
 
74
  = Documentation =
75
  * Full documentation on [tiptoppress.com](http://tiptoppress.com/category-posts-widget/documentation-4-7/?utm_source=wordpress_org&utm_campaign=documentation_4_7_cpw&utm_medium=web)
76
  * Shortcode: Use [catposts] [in the content and edit options in the customizer](http://tiptoppress.com/use-shortcode-to-add-category-posts-widget-to-the-content/?utm_source=wordpress_org&utm_campaign=documentation_shortcode_cpw&utm_medium=web)
77
  * Formatting date and time: See <a target="_blank" href="https://codex.wordpress.org/Formatting_Date_and_Time">Formatting Date and Time</a>
 
78
 
79
  = Contribute =
80
  While using this plugin if you find any bug or any conflict, please submit an issue at
134
  == Changelog ==
135
  [Read more on our blog ...](http://tiptoppress.com/category/category-posts-widget?utm_source=wordpress_org&utm_campaign=changelog_cpw&utm_medium=web)
136
 
137
+ = 4.7.2 - February 25th 2017 =
138
+ * Add option to disable only the font styles
139
+ * Fixed if option 'Everything is a link' no closing anchor tag
140
+ * Fixed if option 'Everyting is a link' wrong layout
141
+ * Fixed when a manual excerpt is provided, use it instead of generating an automatic one
142
+ * Fixed if option 'Disable the built-in CSS' the thumbnail client-side cropping isn't disabled
143
+ * Fixed if option 'Disable the built-in CSS' title class is not rendered
144
+ * Fixed when having multi shortcodes, clicking on a checkbox label marks in any of them selects the one in the "first"
145
+ * Fixed if option 'CSS crop to requested size' for multi shortcodes
146
+ * Fixed for CSS animation
147
+
148
  = 4.7.1 - December 20th 2016 =
149
  * Support multiple shortcodes in content
150
  * Add option for post offset (use two or more widgets after another)
172
  = 4.1.9 - May 5th 2016 =
173
  * Fixed undefined constant.
174
 
175
+ = 4.1.8 - May 3th 2016 =
176
  * Add mouse hover effects: blur
177
  * Add option to choose allowed HTML in the excerpt
178
  * Add Jetpack 'Sharing - Show buttons on posts' support