Problem with search. Help!

Posted in: Newspaper
Post count: 129

Hi!
when i try to search something like MOSTAR PRIJE; here is a example http://crnjaci.com/?s=mostar+prije, I get the results of my homepage (NASLOVNICA) and its codes, how i can repair that? it’s look terrible

Post count: 9544

Seems to be working now.
Also did search for MX4 and got the one result.

You can set layout for search results page in the theme settings panel.

Post count: 129

sorry Chris S. can you look my eighth post in this link http://crnjaci.com/?s=mostar+prije, maybe i wasn’t clear enough first time 🙂 thanks

Post count: 9544

Weird. WordPress search shouldnt show stuff from home page.

Wordpress has kind of crappy search results, and there some plugins to help with that you might look at.

Post count: 6600

Hi,

Add this function to your theme functions file: http://screencast.com/t/XB2LpOjyfR6

function SearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');

Thanks

  • This reply was modified 11 years by Lucian.
Post count: 129

I did as you said, but now it does not work search in the media library :/

Post count: 129

can you help? thanks

Post count: 6600

Hi,

Use it like this:

function SearchFilter($query) {
    if ($query->is_search && ! is_admin()) {
        $query->set('post_type', 'post');
    }
    return $query;
}
add_filter('pre_get_posts','SearchFilter');

.. or just add the && ! is_admin() part to the condition.

Thanks

  • This reply was modified 11 years by Lucian.
Post count: 129

i will try and I’ll contact you later. thanks

Viewing 9 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic.