0

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!

5

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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