[wp-hackers] Useless Filter

Nathan Rice ncrice at gmail.com
Tue Feb 17 21:14:22 GMT 2009


This is outside the loop.  It's in the walker function that generates the
list items for wp_list_pages(); Unfortunately, a global $page var wouldn't
help me.

Nathan

My Website
http://www.nathanrice.net/

My Twitter
http://twitter.com/nathanrice


On Tue, Feb 17, 2009 at 4:07 PM, Alan J Castonguay <alan at verselogic.net>wrote:

> You could store the $page somewhere before the filter is called (it might
> already be in the global space, this is in the Loop?), and reference it from
> within the filter function.
>
> -Alan
>
>
> On 17-Feb-09, at 2:03 PM, Nathan Rice wrote:
>
>  Well, I was just wondering if I overlooked any way of getting some sort of
>> argument (ideally the $page object variable) into my filter function.
>>
>> My Website
>> http://www.nathanrice.net/
>>
>> My Twitter
>> http://twitter.com/nathanrice
>>
>>
>> On Tue, Feb 17, 2009 at 1:58 PM, scribu <scribu at gmail.com> wrote:
>>
>>  No, you can't do add_filter($name, $callback, $priority, $number_of_args,
>>> $CUSTOM_ARGS) right? Or that's not what you're asking...
>>>
>>> On Tue, Feb 17, 2009 at 7:35 PM, Nathan Rice <ncrice at gmail.com> wrote:
>>>
>>>  My mistake guys and gals. The filter isn't useless.
>>>>
>>>> So I'm not missing anything there, though, right?  There is no current
>>>>
>>> way
>>>
>>>> of passing variables into a filter function for that particular instance
>>>>
>>> of
>>>
>>>> the_title?
>>>>
>>>> Nathan
>>>>
>>>> My Website
>>>> http://www.nathanrice.net/
>>>>
>>>> My Twitter
>>>> http://twitter.com/nathanrice
>>>>
>>>>
>>>> On Tue, Feb 17, 2009 at 12:29 PM, Jennifer Hodgdon <
>>>>
>>> yahgrp at poplarware.com
>>>
>>>> wrote:
>>>>>
>>>>
>>>>  In answer to your question at the end of your post: You are missing
>>>>> something. There are some plugins that need to filter titles in a way
>>>>>
>>>> that
>>>>
>>>>> only depends on the text.
>>>>>
>>>>> If you are interested, one example is multi-lingual plugins. When you
>>>>>
>>>> edit
>>>>
>>>>> a post, you type something like this in for the post title:
>>>>>  [lang_en]Title in English[/lang_en][lang_es]Titulo en
>>>>>
>>>> Español[/lang_es]
>>>
>>>> But when the blog is being viewed, you only display either English or
>>>>> Spanish, depending on URL, cookies, etc. That is done with a
>>>>>
>>>> 'the_title'
>>>
>>>> filter, which decides on the language and spits out just one part of
>>>>>
>>>> that
>>>
>>>> text. Independent of post ID, where it is being used, etc.
>>>>>
>>>>> I'm not saying you shouldn't advocate adding some more information to
>>>>> 'the_title', but the current usage is NOT useless.
>>>>>
>>>>>  --Jennifer
>>>>>
>>>>>
>>>>> Nathan Rice wrote:
>>>>>
>>>>>  So last night I was trying to build a plugin when I ran across this
>>>>>>
>>>>> code
>>>
>>>> in
>>>>>> http://svn.automattic.com/wordpress/trunk/wp-includes/classes.php
>>>>>>
>>>>>> $output .= $indent . '<li class="' . $css_class . '"><a href="' .
>>>>>> get_page_link($page->ID) . '" title="' .
>>>>>> attribute_escape(apply_filters('the_title', $page->post_title)) . '">'
>>>>>>
>>>>> .
>>>
>>>> $link_before . apply_filters('the_title', $page->post_title) .
>>>>>>
>>>>> $link_after
>>>>
>>>>> .
>>>>>> '</a>';
>>>>>>
>>>>>>  [...]
>>>>>
>>>>>  Am I missing something, or am I right in thinking that the use of this
>>>>>> filter here is completely non-existent?
>>>>>>
>>>>>>
>>>>> --
>>>>> Jennifer Hodgdon * Poplar ProductivityWare
>>>>> www.poplarware.com
>>>>>
>>>>> Drupal/WordPress Sites, Themes, Modules/Plugins
>>>>> Custom Web Programming, Web Databases
>>>>> PHP, Perl, MySQL, JavaScript, XML, AJAX
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>>
>>>>
>>>
>>>
>>> --
>>> http://scribu.net
>>> _______________________________________________
>>> 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
>>
>
> _______________________________________________
> 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