[wp-hackers] Passing arguments to wp_list_pages

Ade Walker photofantaisie at gmail.com
Mon Jan 12 17:35:34 GMT 2009


For those that are interested, it was simple syntax error that was causing
my problem. Here's the final code:

function my_list_pages() {

// Code to pull in theme options here and set variables
// goes here....

$args = array ("depth" => $page_depth,
                    "exclude" => $exclude_output,
                    "sort_column" => $sort_column,
                    "title_li" => '',
                );
wp_list_pages($args);
}

Nothing earth-shattering, but suits my purposes well. Thanks Mike for making
me take another look! :-)

Ade.





2009/1/12 Ade Walker <photofantaisie at gmail.com>

> Mike,
>
> Thanks for the reply. Yes, that's a good idea.
>
> Oops! Actually, I do need to check my code again because looking at the
> snippet I posted in my mail, I've misspelt "title_li". I don't have access
> to my development PC from here so I can't see what I've got in the source,
> but I wonder if that was the problem all along...  Hopefully, I've just
> found the bug. I'll let you know. :-)
>
> Thanks.
>
> Ade.
> 2009/1/12 Mike Schinkel <mikeschinkel at gmail.com>
>
> Ade:
>>
>> Interesting.  Can you produce a standalone file in a pastebin that when
>> dropped in the root of a v2.7 install will execute by calling the php file
>> via URL (i.e. test.php to be called with http://example.com/test.php)
>> that
>> will result the in problem you've found?  If so, I could debug it for you
>> (but I'll bet you'll figure it out by going through the process of
>> preparing
>> such a test file...)
>>
>> -Mike Schinkel
>> http://mikeschinkel.com
>>
>>
>> On Mon, Jan 12, 2009 at 4:05 AM, Ade Walker <photofantaisie at gmail.com
>> >wrote:
>>
>> > Hi all,
>> >
>> > I'm trying to write a function which can pass certain user-definable
>> > arguments (via a theme options page) to wp_list_pages().
>> >
>> > In my function I have this:
>> >
>> > function (mypagesfunction) {
>> >
>> > // code to pull in theme options and set variables
>> >
>> > $args = array ( "depth" => $page_depth,
>> >                    "exclude" => $exclude_output,
>> >                    "sort_column" => $sort_column,
>> >                    "tite_li" => '',
>> >                );
>> > $newpages = wp_list_pages($args);
>> > echo $newpages;
>> > }
>> >
>> > The variables in the array are pulled from theme options (I've left this
>> > code out, above).
>> >
>> > All works fine EXCEPT the title_li argument (I don't want a title_li)
>> which
>> > is being ignored. I'm sure I've missed something blindingly obvious - I
>> > just
>> > can't see what it is. :-)
>> >
>> > Any ideas?
>> >
>> > Thanks.
>> >
>> > Ade.
>> > _______________________________________________
>> > 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