<?php
add_filter('posts_where', 'title_like_posts_where', 10, 2); // wyszukiwarka
function title_like_posts_where( $where ) {
global $wpdb;
global $query_params;
if ($post_title_like = $query_params['post_title_like']){
$where .= ' AND '. $wpdb->posts . '.post_title LIKE \'%' . $wpdb->esc_like($post_title_like) . '%\'';
//$where .= ' AND '. $wpdb->posts . '.comment_count > 2';
}
//print_r($where);
return $where;
}
//$post_title_like - zawartosc pola input wyszukiwarki
?>
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.