Media Library Categories - Version 1.8

Version Description

  • Indent child categories in checklist media popup
Download this release

Release Info

Developer jeffrey-wp
Plugin Icon 128x128 Media Library Categories
Version 1.8
Comparing to
See all releases

Code changes from version 1.7 to 1.8

css/wpmediacategory.css CHANGED
@@ -1,4 +1,13 @@
1
- /* category fields */
2
- .compat-field-category label span {
3
  color: inherit;
 
 
 
 
 
 
 
 
 
4
  }
1
+ /* category checklist media popup */
2
+ .compat-attachment-fields label span {
3
  color: inherit;
4
+ }
5
+ .compat-attachment-fields .children {
6
+ margin: 5px 0 0 20px;
7
+ }
8
+ .compat-attachment-fields .field input[type="checkbox"] {
9
+ margin-top: 0;
10
+ }
11
+ .compat-attachment-fields .term-list {
12
+ margin-top: 5px;
13
  }
css/wpmediacategory.min.css CHANGED
@@ -1 +1 @@
1
- .compat-field-category label span{color:inherit}
1
+ .compat-attachment-fields label span{color:inherit}.compat-attachment-fields .children{margin:5px 0 0 20px}.compat-attachment-fields .field input[type=checkbox]{margin-top:0}.compat-attachment-fields .term-list{margin-top:5px}
include/walkers.php CHANGED
@@ -49,7 +49,7 @@ class wpmediacategory_walker_category_mediagridfilter extends Walker_CategoryDro
49
 
50
  }
51
 
52
- /** Custom walker for wp_dropdown_categories for media grid view filter */
53
  class wpmediacategory_walker_media_taxonomy_checklist extends Walker {
54
 
55
  var $tree_type = 'category';
@@ -59,12 +59,12 @@ class wpmediacategory_walker_media_taxonomy_checklist extends Walker {
59
  );
60
 
61
  function start_lvl( &$output, $depth = 0, $args = array() ) {
62
- $indent = str_repeat( "\t", $depth );
63
  $output .= "$indent<ul class='children'>\n";
64
  }
65
 
66
  function end_lvl( &$output, $depth = 0, $args = array() ) {
67
- $indent = str_repeat("\t", $depth);
68
  $output .= "$indent</ul>\n";
69
  }
70
 
@@ -76,10 +76,14 @@ class wpmediacategory_walker_media_taxonomy_checklist extends Walker {
76
  // Add filter to change the default taxonomy
77
  $taxonomy = apply_filters( 'wpmediacategory_taxonomy', $taxonomy );
78
 
79
- $name = 'tax_input[' . $taxonomy . ']';
 
80
 
81
- $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
82
- $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->slug . '" type="checkbox" name="' . $name . '[' . $category->slug . ']" id="in-' . $taxonomy . '-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
 
 
 
83
  }
84
 
85
  function end_el( &$output, $category, $depth = 0, $args = array() ) {
49
 
50
  }
51
 
52
+ /** Custom walker for wp_terms_checklist for media grid view filter */
53
  class wpmediacategory_walker_media_taxonomy_checklist extends Walker {
54
 
55
  var $tree_type = 'category';
59
  );
60
 
61
  function start_lvl( &$output, $depth = 0, $args = array() ) {
62
+ $indent = str_repeat( "\t", $depth );
63
  $output .= "$indent<ul class='children'>\n";
64
  }
65
 
66
  function end_lvl( &$output, $depth = 0, $args = array() ) {
67
+ $indent = str_repeat( "\t", $depth );
68
  $output .= "$indent</ul>\n";
69
  }
70
 
76
  // Add filter to change the default taxonomy
77
  $taxonomy = apply_filters( 'wpmediacategory_taxonomy', $taxonomy );
78
 
79
+ $name = 'tax_input[' . $taxonomy . ']';
80
+ $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
81
 
82
+ $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" .
83
+ '<label class="selectit"><input value="' . $category->slug . '" type="checkbox" name="' . $name . '[' . $category->slug . ']" id="in-' . $taxonomy . '-' . $category->term_id . '"' .
84
+ checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) .
85
+ disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .
86
+ esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
87
  }
88
 
89
  function end_el( &$output, $category, $depth = 0, $args = array() ) {
index.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Media Library Categories
4
  * Plugin URI: https://wordpress.org/plugins/wp-media-library-categories/
5
  * Description: Adds the ability to use categories in the media library.
6
- * Version: 1.7
7
  * Author: Jeffrey-WP
8
  * Text Domain: wp-media-library-categories
9
  * Domain Path: /languages
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
22
  */
23
  class wpMediaLibraryCategories {
24
 
25
- public $plugin_version = '1.7';
26
 
27
  /**
28
  * Initialize the hooks and filters
3
  * Plugin Name: Media Library Categories
4
  * Plugin URI: https://wordpress.org/plugins/wp-media-library-categories/
5
  * Description: Adds the ability to use categories in the media library.
6
+ * Version: 1.8
7
  * Author: Jeffrey-WP
8
  * Text Domain: wp-media-library-categories
9
  * Domain Path: /languages
22
  */
23
  class wpMediaLibraryCategories {
24
 
25
+ public $plugin_version = '1.8';
26
 
27
  /**
28
  * Initialize the hooks and filters
languages/wp-media-library-categories.pot CHANGED
@@ -1,9 +1,9 @@
1
- # Copyright (C) 2016 Media Library Categories
2
  # This file is distributed under the same license as the Media Library Categories package.
3
  #, fuzzy
4
  msgid ""
5
  msgstr ""
6
- "Project-Id-Version: Media Library Categories 1.7\n"
7
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-media-library-"
8
  "categories\n"
9
  "POT-Creation-Date: 2018-11-29 22:05+0100\n"
@@ -14,7 +14,9 @@ msgstr ""
14
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15
  "Language-Team: LANGUAGE <LL@li.org>\n"
16
  "X-Generator: Poedit 2.1.1\n"
17
- "X-Poedit-KeywordsList: __;_e\n"
 
 
18
  "X-Poedit-Basepath: ..\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
1
+ # Copyright (C) jeffrey-wp.com
2
  # This file is distributed under the same license as the Media Library Categories package.
3
  #, fuzzy
4
  msgid ""
5
  msgstr ""
6
+ "Project-Id-Version: Media Library Categories\n"
7
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-media-library-"
8
  "categories\n"
9
  "POT-Creation-Date: 2018-11-29 22:05+0100\n"
14
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15
  "Language-Team: LANGUAGE <LL@li.org>\n"
16
  "X-Generator: Poedit 2.1.1\n"
17
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
18
+ "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;"
19
+ "esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
20
  "X-Poedit-Basepath: ..\n"
21
  "X-Poedit-SearchPath-0: .\n"
22
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Plugin Name ===
2
  Contributors: jeffrey-wp
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SSNQMST6R28Q2
4
  Tags: category, categories, media, library, medialibrary, image, images, media category, media categories
5
  Requires at least: 3.1
6
- Tested up to: 5.0.2
7
- Stable tag: 1.7
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -23,7 +23,7 @@ There is even an option to filter on categories when using the gallery shortcode
23
  * filter on categories in the media library
24
  * filter on categories in the gallery shortcode
25
  * taxonomy filter
26
- * support for WordPress 3.1 – 5.0
27
 
28
  > <strong>Try Premium version - 100% money back guarantee</strong>
29
  > WordPress Media Library Categories Premium adds the option to filter on categories when inserting media into a post or page.
@@ -56,26 +56,35 @@ To upload the plugin through WordPress, instead of FTP:
56
 
57
  = How to use separate categories for the WordPress Media Library (and don't use the same categories as in posts & pages)? =
58
  By default the WordPress Media Library uses the same categories as WordPress does (such as in posts & pages). If you want to use separate categories for the WordPress Media Library add this code to the file functions.php located in your theme or child-theme:
59
- `/**
 
60
  * separate media categories from post categories
61
  * use a custom category called 'category_media' for the categories in the media library
62
  */
63
  add_filter( 'wpmediacategory_taxonomy', function(){ return 'category_media'; } ); //requires PHP 5.3 or newer
64
- `
65
- Or if you have an older PHP version:
66
- `add_filter( 'wpmediacategory_taxonomy', create_function( '', 'return "category_media";' ) ); //requires PHP 4.0.1 or newer`
67
 
68
 
69
  = How to use category in the [gallery] shortcode? =
70
  To only show images from one category in the gallery you have to add the '`category`' attribute to the `[gallery]` shortcode.
71
  The value passed to the '`category`' attribute can be either the `category slug` or the `term_id`, for example with the category slug:
72
- `[gallery category="my-category-slug"]
 
 
73
  Or with term_id:
74
- [gallery category="14"]`
75
- If you use an incorrect slug by default WordPress shows the images that are attached to the page / post that is displayed. If you use an incorrect term_id no images are shown. Aside from this behavior, the `[gallery]` shortcode works as it does by default with the built-in shortcode from WordPress ([see the WordPress gallery shortcode codex page](https://codex.wordpress.org/Gallery_Shortcode)). If you only want to show attachments uploaded to the page and filtered by category than use the '`id`' in combination with the '`category`' attribute. For example (the id of the post is 123):
76
- `[gallery category="my-category-slug" id="123"]
 
 
 
 
 
 
77
  Or leave id empty for current page / post:
78
- [gallery category="my-category-slug" id=""]`
 
 
79
  In this example the slug is used, but you could also use the term_id.
80
 
81
 
@@ -95,6 +104,9 @@ Maintaining a plugin and keeping it up to date is hard work. Please support me b
95
 
96
  == Changelog ==
97
 
 
 
 
98
  = 1.7 =
99
  * Support WordPress 5.0
100
  * Support multiple slugs and id's in gallery shortcode
@@ -110,4 +122,4 @@ Maintaining a plugin and keeping it up to date is hard work. Please support me b
110
  * Rewrite entire plugin to improve quality and make it ready for future development
111
  * Move language files to GlotPress
112
 
113
- [See complete changelog for all versions](https://jeffrey-wp.com/wordpress-plugin/media-library-categories/changelog/?utm_source=plugin&utm_medium=changelog&utm_campaign=wpmlc).
1
+ === Plugin Name ===
2
  Contributors: jeffrey-wp
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SSNQMST6R28Q2
4
  Tags: category, categories, media, library, medialibrary, image, images, media category, media categories
5
  Requires at least: 3.1
6
+ Tested up to: 5.3
7
+ Stable tag: 1.8
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
23
  * filter on categories in the media library
24
  * filter on categories in the gallery shortcode
25
  * taxonomy filter
26
+ * support for WordPress 3.1 – 5.3
27
 
28
  > <strong>Try Premium version - 100% money back guarantee</strong>
29
  > WordPress Media Library Categories Premium adds the option to filter on categories when inserting media into a post or page.
56
 
57
  = How to use separate categories for the WordPress Media Library (and don't use the same categories as in posts & pages)? =
58
  By default the WordPress Media Library uses the same categories as WordPress does (such as in posts & pages). If you want to use separate categories for the WordPress Media Library add this code to the file functions.php located in your theme or child-theme:
59
+ <code>
60
+ /**
61
  * separate media categories from post categories
62
  * use a custom category called 'category_media' for the categories in the media library
63
  */
64
  add_filter( 'wpmediacategory_taxonomy', function(){ return 'category_media'; } ); //requires PHP 5.3 or newer
65
+ </code>
 
 
66
 
67
 
68
  = How to use category in the [gallery] shortcode? =
69
  To only show images from one category in the gallery you have to add the '`category`' attribute to the `[gallery]` shortcode.
70
  The value passed to the '`category`' attribute can be either the `category slug` or the `term_id`, for example with the category slug:
71
+ <code>
72
+ [gallery category="my-category-slug"]
73
+ </code>
74
  Or with term_id:
75
+ <code>
76
+ [gallery category="14"]
77
+ </code>
78
+ If you use an incorrect slug by default WordPress shows the images that are attached to the page / post that is displayed. If you use an incorrect term_id no images are shown.
79
+
80
+ Aside from this behavior, the `[gallery]` shortcode works as it does by default with the built-in shortcode from WordPress ([see the WordPress gallery shortcode codex page](https://codex.wordpress.org/Gallery_Shortcode)). If you only want to show attachments uploaded to the page and filtered by category than use the '`id`' in combination with the '`category`' attribute. For example (the id of the post is 123):
81
+ <code>
82
+ [gallery category="my-category-slug" id="123"]
83
+ </code>
84
  Or leave id empty for current page / post:
85
+ <code>
86
+ [gallery category="my-category-slug" id=""]
87
+ </code>
88
  In this example the slug is used, but you could also use the term_id.
89
 
90
 
104
 
105
  == Changelog ==
106
 
107
+ = 1.8 =
108
+ * Indent child categories in checklist media popup
109
+
110
  = 1.7 =
111
  * Support WordPress 5.0
112
  * Support multiple slugs and id's in gallery shortcode
122
  * Rewrite entire plugin to improve quality and make it ready for future development
123
  * Move language files to GlotPress
124
 
125
+ [See complete changelog for all versions](https://jeffrey-wp.com/media-library-categories-changelog/?utm_source=plugin&utm_medium=changelog&utm_campaign=wpmlc).