Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a shortcode function that returns:

return '<ul class="list-pages">'. wp_list_pages( $args ) .'</ul>';

Of course it returns:

{pages}
<ul class="list-pages"></ul>

Instead of:

<ul class="list-pages">
   {pages}
</ul>

There is almost the same question, but for echo:

Why does this echo values in the wrong order?

And it works perfectly for echo, but I don't know how to use PHP line breaking with "return" (it breaks the whole code).

Thank you!

share|improve this question

1 Answer 1

up vote 5 down vote accepted

it is b/c wp_list_pages ECHOES by default. so it echoes before your return happens.

wherever you are defining your $args, set

'echo' => FALSE,

see http://codex.wordpress.org/Function_Reference/wp_list_pages

share|improve this answer
    
brilliant, thanks a lot! :) –  Wordpressor Jul 28 '11 at 20:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.