Changeset 1114203
- Timestamp:
- 03/16/2015 10:42:56 PM (11 years ago)
- Location:
- search-by-id/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (4 diffs)
-
search-by-id.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
search-by-id/trunk/readme.txt
r1003294 r1114203 1 1 === Search by ID === 2 2 Contributors: wpkonsulent 3 Tags: search, posts, pages, custom post types, id, admin4 Requires at least: 3.0.15 Tested up to: 4. 06 Stable tag: 1. 13 Tags: search, posts, pages, custom post types, media, id, admin 4 Requires at least: 4.0 5 Tested up to: 4.1.1 6 Stable tag: 1.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 15 15 16 16 = Features: = 17 * Works for all kinds of posts (regular posts, pages, custom post types ).17 * Works for all kinds of posts (regular posts, pages, custom post types and media). 18 18 * No configuration needed. 19 * Doesn't add javascript or css .19 * Doesn't add javascript or css; it has virtually no impact whatsoever. 20 20 * No front-end functionality, just back-end. 21 21 * Doesn't add any options or tables to the database. 22 22 23 Just a nice and easy, seamless extension of the built-in search.23 Just a nice, clean and easy, seamless extension of the built-in search. 24 24 25 25 = How to use it: = … … 45 45 There is nothing new to be found, my friend. It hooks into the good old search input field you see in the top right corner when viewing the lists of posts (or pages, or whatever post type you may use). Just enter an ID into that field, and you will see. 46 46 47 = It's not working = 48 49 That's not really a very descriptive question, but I shall try to answer nonetheless ;). If you find that searching for an ID that definitely does exist does not work, it's most likely because you have another plugin installed that interferes with the same filter that this plugin uses. I'm afraid I can't do anything about that. 50 47 51 == Screenshots == 48 52 … … 51 55 == Changelog == 52 56 57 = 1.2 = 58 59 * Updated for 4.1.1. Slight rewrite of the filter was necessary. Updated description and FAQ. 60 53 61 = 1.1 = 54 62 * Added support for searching multiple IDs. Credit goes to Ben Wise for suggesting this. -
search-by-id/trunk/search-by-id.php
r726666 r1114203 3 3 Plugin Name: Search by ID 4 4 Plugin URI: 5 Description: Enables the user to search by post ID using the built-in search within the administration area. Works for all kinds of posts (posts, pages, custom post types ).6 Version: 1. 15 Description: Enables the user to search by post ID using the built-in search within the administration area. Works for all kinds of posts (posts, pages, custom post types and media). 6 Version: 1.2 7 7 Author: Uffe Fey, WordPress consultant 8 8 Author URI: http://wpkonsulent.dk 9 9 */ 10 $wpkonsulent_searchbyid =new WPkonsulentSearchById();10 new WPkonsulentSearchById(); 11 11 12 12 class WPkonsulentSearchById 13 13 { 14 function WPkonsulentSearchById()15 {16 $this->__construct();17 }18 19 14 function __construct() 20 15 { … … 33 28 { 34 29 global $wpdb; 35 $where .= ' or ' . $wpdb->posts . '.ID = ' . $s; 30 31 $where = str_replace('(' . $wpdb->posts . '.post_title LIKE', '(' . $wpdb->posts . '.ID = ' . $s . ') OR (' . $wpdb->posts . '.post_title LIKE', $where); 36 32 } 37 33 elseif(preg_match("/^(\d+)(,\s*\d+)*\$/", $s)) // string of post IDs 38 34 { 39 35 global $wpdb; 40 $where .= ' or ' . $wpdb->posts . '.ID in (' . $s . ')'; 36 37 $where = str_replace('(' . $wpdb->posts . '.post_title LIKE', '(' . $wpdb->posts . '.ID in (' . $s . ')) OR (' . $wpdb->posts . '.post_title LIKE', $where); 41 38 } 42 39 }
Note: See TracChangeset
for help on using the changeset viewer.