Changeset 1779144
- Timestamp:
- 12/01/2017 12:01:59 AM (8 years ago)
- Location:
- bb-gallery/trunk
- Files:
-
- 3 edited
-
bbg_xiv-gallery.php (modified) (3 diffs)
-
js/bbg_xiv-gallery.js (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bb-gallery/trunk/bbg_xiv-gallery.php
r1771903 r1779144 5 5 Plugin URI: https://bbfgallery.wordpress.com/ 6 6 Description: Gallery using Backbone.js, Bootstrap 3 and CSS3 Flexbox 7 Version: 1.8.2.4. 17 Version: 1.8.2.4.2 8 8 Author: Magenta Cuda 9 9 Author URI: https://profiles.wordpress.org/magenta-cuda/ … … 274 274 // Translate the terms of the proprietary 'bb_tags' attribute to ids 275 275 $bb_tags = array_map( 'trim', explode( ',', $atts['bb_tags'] ) ); 276 $attributes[ 'bb-tags' ] = get_terms( [ 'taxonomy' => 'bb_tags', 'slug' => $bb_tags, 'name' => $bb_tags, 'fields' => 'ids' ] );276 $attributes[ 'bb-tags' ] = get_terms( [ 'taxonomy' => 'bb_tags', 'slug' => $bb_tags, 'name' => $bb_tags, 'fields' => 'ids', 'hide_empty' => FALSE ] ); 277 277 } else if ( ! empty( $atts[ 'include' ] ) ) { 278 278 $attributes[ 'include' ] = explode( ',', $atts[ 'include' ] ); … … 894 894 895 895 if ( self::$wp_rest_api_available && self::$use_wp_rest_api_if_available ) { 896 add_filter( 'rest_pre_dispatch', function( $null, $server, $request ) { 897 # translate taxonomy slugs and names to ids since WP REST API doesn't accept slugs or names 898 if ( !empty( $request[ 'bb-tags' ] ) ) { 899 $bb_tags = array_map( 'trim', explode( ',', $request[ 'bb-tags' ] ) ); 900 if ( !is_numeric( $bb_tags[ 0 ] ) ) { 901 $request[ 'bb-tags' ] = implode( ',', get_terms( [ 'taxonomy' => 'bb_tags', 'slug' => $bb_tags, 'name' => $bb_tags, 'fields' => 'ids' ] ) ); 902 } 896 # add_filter( 'rest_pre_dispatch', function( $null, $server, $request ) { 897 # error_log( 'FILTER::rest_pre_dispatch():$request=' . print_r( $request, true ) ); 898 # return NULL; 899 # }, 10, 3 ); 900 add_filter( 'rest_attachment_query', function( $args, $request ) { 901 if ( !empty( $args[ 's' ] ) ) { 902 $terms = get_terms( [ 'taxonomy' => 'bb_tags', 'slug' => $args[ 's' ], 'name' => $args[ 's' ], 'fields' => 'ids', 'hide_empty' => FALSE ] ); 903 if ( $terms ) { 904 # taxonomy has a higher priority than search 905 unset( $args[ 's' ] ); 906 $args['tax_query'][] = [ 907 'taxonomy' => 'bb_tags', 908 'field' => 'term_id', 909 'terms' => $terms, 910 'include_children' => FALSE, 911 ]; 912 } 903 913 } 904 return NULL;905 }, 10, 3);914 return $args; 915 }, 10, 2 ); 906 916 } 907 917 } ); -
bb-gallery/trunk/js/bbg_xiv-gallery.js
r1771903 r1779144 1563 1563 data:{ 1564 1564 search:query, 1565 // 'bb-tags':query, 1565 1566 page:page++, 1566 1567 per_page:searchLimit -
bb-gallery/trunk/readme.txt
r1771903 r1779144 4 4 Requires at least: 4.4 5 5 Tested up to: 4.9 6 Stable tag: 1.8.2.4. 16 Stable tag: 1.8.2.4.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 44 44 == Changelog == 45 45 46 = 1.8.2.4.2 = 47 48 * bb_tags now includes unattached images 49 * search now uses the bb_tags taxonomy 50 46 51 = 1.8.2.4.1 = 47 52 … … 198 203 == Upgrade Notice == 199 204 205 = 1.8.2.4.2 = 206 207 * bb_tags now includes unattached images 208 * search now uses the bb_tags taxonomy 209 200 210 = 1.8.2.4.1 = 201 211
Note: See TracChangeset
for help on using the changeset viewer.