Hello everyone, I've been trying to modify the search function on my
site to only show my blog entries instead of both entries and pages,
I've figured that the problem most probably is that somewhere in
system/classes where the search results are retrieved there is a
function looking for content-type any instead of content-type entry.
My problem is that i'm not very good at coding and I don't know where
to find it or if it is safe to modify this option without changing
other parts of the site where content is retrieved. Even if I
definitely would use an override in the users/classes directory.
So my question is if it is possible to do this or if it is hard coded.
Any help would be very appreciated.
Right now i'm using a workaround with this code before and after the
output of the search results in my theme search.php and then assigning
a nosearch tag on all my pages.
<?php if (!in_array('nosearch', $post->tags)): ?>
...
<?php endif; ?>
This workaround does work, however it creates a new problem with the
page-selector below all the results on the search page. What happens
is that the page-selector still see the pages as a part of the search
results even if they are hidden from output.
An example, my search results would normally show 10 entries on every
page and i make a search for the word "test" and i get 9 results that
will be shown, but since i also have two pages with the word "test"
written on them although those pages have the "nosearch" tag. Those
two pages are hidden from output, but the page-selector see them as a
part of the results and say there are two pages of search results
instead of just 1.
The reason I want to change the search function to only show entries
instead of both entries and pages is mostly because I have moved the
search function to it's own page instead of having it on the sidebar,
which means my custom search page would show up in the results. I also
have a few other custom pages like an archive page that shouldn't be
output among normal search-results either.
If there is a way to actually make the page-selector understand that
i've hidden the nosearch-tag from output then that would be an even
better solution than to change the content-type, since it would allow
other content-types to be created later and still let them be
searchable. But i think that might be very hard to do.
Please tell me if i've got something wrong, I'm not very good at
coding, but I'm trying my best.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/habari-users
-~----------~----~----~----~------~----~------~--~---