[wp-hackers] Restrict search results?

Paul Menard paul at codehooligans.com
Mon Jul 21 00:48:27 GMT 2008


This actually brings up something I read some time ago (early 2008)  
that WordPress would be including Pages in searches. My apologies but  
I don't know if these ever made it into a official release.

For Categories and Tags there are some very nice taxonomy related  
settings:

category__in, category__not_in, category__in, category__not_in,  
category__and, tag__in, tag__not_in, tag__and

These can be easily used in the case of a search or whatever. I  
actually use them heavily for a plugin I wrote earlier Simply Exclude  
But for Pages one has to jump through some ugly action code to  
manipulate the SQL query itself. Ugly ugly stuff.

So for Pages it would be nice to have a similar set of settings like
page__in, page__not_in

P-


On Jul 20, 2008, at 7:26 PM, Viper007Bond wrote:

> Good thinking! Sadly query_posts() doesn't accept meta parameters, but
> that's still easier than using parent or whatever in the SQL filters
> (post_where, etc.).
>
> On Sun, Jul 20, 2008 at 4:15 PM, Glenn Ansley  
> <glenn at glennansley.com> wrote:
>
>> You might consider giving them all the same custom_value and create  
>> a quick
>> plugin that adds that meta value to search parameters... that would
>> preserve
>> the post_type...just a though.
>>
>> On Sun, Jul 20, 2008 at 5:32 PM, Viper007Bond  
>> <viper at viper007bond.com>
>> wrote:
>>
>>> I need them to be actual pages so I can display them without huge
>> hacking.
>>>
>>> And actually all of these pages will have a common parent.
>>>
>>> This is the format I'm gonna move to pages:
>>> http://www.finalgear.com/shows/topgear/11/4/   That's currently
>>> mod_rewrite
>>> + a custom script.
>>>
>>> On Sun, Jul 20, 2008 at 2:32 AM, DD32 <wordpress at dd32.id.au> wrote:
>>>
>>>> Just a thought, Would it be possible to assign these pages a custom
>>>> taxonomy(like a category or tags), and have your search page  
>>>> limit it
>> to
>>>> items within that taxonomy?
>>>>
>>>> Another method i can think of, Which most likely will not work  
>>>> for you,
>>> Is
>>>> to assign the pages to have a parent page which only acts as a  
>>>> stub,
>>>> Allthough it takes a bit of effort to remove the stub from the
>> permalink
>>> for
>>>> the page..
>>>>
>>>>
>>>> On Sun, 20 Jul 2008 19:25:23 +1000, Viper007Bond <
>> viper at viper007bond.com
>>>>
>>>> wrote:
>>>>
>>>> That opens a whole other can of worms though for what I'm doing  
>>>> when
>> it
>>>>> comes to displaying and managing the content. I might as well  
>>>>> stick to
>>> my
>>>>> current custom scripts.
>>>>>
>>>>> On Sat, Jul 19, 2008 at 10:13 PM, Jason Webster <jason at intraffic.net 
>>>>> >
>>>>> wrote:
>>>>>
>>>>> I have achieved this by assigning the special pages their own
>> post_type
>>>>>> field in the database, and applying some filters to the posts_*
>> hooks.
>>> I
>>>>>> can
>>>>>> elaborate more, if you'd like, however I'm about to pass out from
>>>>>> exhaustion.
>>>>>>
>>>>>> -Jason
>>>>>>
>>>>>> Viper007Bond wrote:
>>>>>>
>>>>>> I'm in the process of converting one of my half WordPress-powered
>>> sites
>>>>>>> to
>>>>>>> be fully WordPress. It currently uses a custom table and custom
>>> scripts
>>>>>>> to
>>>>>>> output Page-like content. I will be transitioning this data to  
>>>>>>> be
>>> actual
>>>>>>> Pages and meta content.
>>>>>>>
>>>>>>> However, I want to be able to search these Pages and only these
>> Pages
>>>>>>> (rather than posts and other Pages). Is this possible? Or do I  
>>>>>>> need
>> to
>>>>>>> manually query?
>>>>>>>
>>>>>>> More importantly though, how can I exclude these Pages for  
>>>>>>> when I
>> want
>>>>>>> to
>>>>>>> search the posts (site news)?
>>>>>>>
>>>>>>> Is it just a matter of playing with WP_Query or am I SOL?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> _______________________________________________
>>>>>> wp-hackers mailing list
>>>>>> wp-hackers at lists.automattic.com
>>>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> wp-hackers mailing list
>>>> wp-hackers at lists.automattic.com
>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>
>>>
>>>
>>>
>>> --
>>> Viper007Bond | http://www.viper007bond.com/ | http://www.finalgear.com/
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> -- 
> Viper007Bond | http://www.viper007bond.com/ | http:// 
> www.finalgear.com/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list