maojiemng
Forum Replies Created
-
Forum: Requests and Feedback
In reply to: A bug with wordpress 2.7 on “sticky post function”no boy can?
Forum: Themes and Templates
In reply to: how to pass argument from search-form to search.phpit’s very simple ,ooooh my god!
http://localhost/?s=piece&id=1
$_GET[‘id’]Forum: Themes and Templates
In reply to: How to change The full text search to The title search?( 1 ) Search by Title ONLY!
File: wp-includes/query.php
REPLACE:
$search .= “{$searchand}(($wpdb->posts.post_title LIKE ‘{$n}{$term}{$n}’) OR ($wpdb->posts.post_content LIKE ‘{$n}{$term}{$n}
WITH:
$search .= “{$searchand}(($wpdb->posts.post_title LIKE ‘{$n}{$term}{$n}’) )”;
REPLACE:
$search .= ” OR ($wpdb->posts.post_title LIKE ‘{$n}{$term}{$n}’) OR ($wpdb->posts.post_content LIKE ‘{$n}{$term}{$n}’)”;
WITH:
$search .= ” OR ($wpdb->posts.post_title LIKE ‘{$n}{$term}{$n}’) “;
Forum: Themes and Templates
In reply to: How to change The full text search to The title search?I found some Code that may be usefull in wp-include/query.php file.
line:1739–>line:1761// If a search pattern is specified, load the posts that match
if ( !empty($q[‘s’]) ) {
// added slashes screw with quote grouping when done early, so done later
$q[‘s’] = stripslashes($q[‘s’]);
if ( !empty($q[‘sentence’]) ) {
$q[‘search_terms’] = array($q[‘s’]);
} else {
preg_match_all(‘/”.*?(“|$)|((?<=[\\s”,+])|^)[^\\s”,+]+/’, $q[‘s’], $matches);
$q[‘search_terms’] = array_map(create_function(‘$a’, ‘return trim($a, “\\”\’\\n\\r “);’), $matches[0]);
}
$n = !empty($q[‘exact’]) ? ” : ‘%’;
$searchand = ”;
foreach( (array) $q[‘search_terms’] as $term) {
$term = addslashes_gpc($term);
$search .= “{$searchand}(($wpdb->posts.post_title LIKE ‘{$n}{$term}{$n}’) OR ($wpdb->posts.post_content LIKE ‘{$n}{$term}{$n}’))”;
$searchand = ‘ AND ‘;
}
$term = $wpdb->escape($q[‘s’]);
if (empty($q[‘sentence’]) && count($q[‘search_terms’]) > 1 && $q[‘search_terms’][0] != $q[‘s’] )
$search .= ” OR ($wpdb->posts.post_title LIKE ‘{$n}{$term}{$n}’) OR ($wpdb->posts.post_content LIKE ‘{$n}{$term}{$n}’)”;if ( !empty($search) )
$search = ” AND ({$search}) “;
}`these code define how to search by keywords. but there don’t define argument by category.
anyone can give me some advice to change to search by category.
Forum: Themes and Templates
In reply to: How to change The full text search to The title search?I found some Code that may be usefull in wp-include/query.php file.
line:1739–>line:1761// If a search pattern is specified, load the posts that match if ( !empty($q['s']) ) { // added slashes screw with quote grouping when done early, so done later $q['s'] = stripslashes($q['s']); if ( !empty($q['sentence']) ) { $q['search_terms'] = array($q['s']); } else { preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $q['s'], $matches); $q['search_terms'] = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]); } $n = !empty($q['exact']) ? '' : '%'; $searchand = ''; foreach( (array) $q['search_terms'] as $term) { $term = addslashes_gpc($term); $search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'))"; $searchand = ' AND '; } $term = $wpdb->escape($q['s']); if (empty($q['sentence']) && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] ) $search .= " OR ($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}')"; if ( !empty($search) ) $search = " AND ({$search}) "; }these code define how to search by keywords. but there don’t define argument by category.
anyone can give me some advice to change to search by category.
Forum: Themes and Templates
In reply to: How to change The full text search to The title search?I found some Code that may be usefull in wp-include/query.php file.
line:1739–>line:1761// If a search pattern is specified, load the posts that match if ( !empty($q['s']) ) { // added slashes screw with quote grouping when done early, so done later $q['s'] = stripslashes($q['s']); if ( !empty($q['sentence']) ) { $q['search_terms'] = array($q['s']); } else { preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $q['s'], $matches); $q['search_terms'] = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]); } $n = !empty($q['exact']) ? '' : '%'; $searchand = ''; foreach( (array) $q['search_terms'] as $term) { $term = addslashes_gpc($term); $search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'))"; $searchand = ' AND '; } $term = $wpdb->escape($q['s']); if (empty($q['sentence']) && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] ) $search .= " OR ($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}')"; if ( !empty($search) ) $search = " AND ({$search}) "; }these code define how to search by keywords. but there don’t define argument by category.
anyone can give me some advice to change to search by category.
Forum: Themes and Templates
In reply to: How to change The full text search to The title search?I found some Code that may be usefull in wp-include/query.php
line:1739–>line:1761// If a search pattern is specified, load the posts that match if ( !empty($q['s']) ) { // added slashes screw with quote grouping when done early, so done later $q['s'] = stripslashes($q['s']); if ( !empty($q['sentence']) ) { $q['search_terms'] = array($q['s']); } else { preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $q['s'], $matches); $q['search_terms'] = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]); } $n = !empty($q['exact']) ? '' : '%'; $searchand = ''; foreach( (array) $q['search_terms'] as $term) { $term = addslashes_gpc($term); $search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'))"; $searchand = ' AND '; } $term = $wpdb->escape($q['s']); if (empty($q['sentence']) && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] ) $search .= " OR ($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}')"; if ( !empty($search) ) $search = " AND ({$search}) "; }these code define how to search by keywords. but there don’t define argument by category.
anyone can give me some advice to change to search by category.
Forum: Everything else WordPress
In reply to: Anybody can set category link to sub-domain form?lasted update Author:
Plugin Name:Category Subdomains
Download-Url: http://webdev.casualgenius.com/projects/category-subdomains/Forum: Everything else WordPress
In reply to: Anybody can set category link to sub-domain form?Thank you! I will try it.