Make WordPress Core

Opened 22 years ago

Closed 22 years ago

Last modified 8 years ago

#1270 closed enhancement (fixed)

Add "echo" option to wp_list_pages ( as well as _page_level_out() )

Reported by: MC_incubus Owned by: ryan
Priority: high Milestone:
Component: General Version: 1.5.1
Severity: normal Keywords:
Cc: Focuses:

Description

wp_list_pages() and _page_level_out() both have hardcoded echoes. The enclosed patch gives each an echo switch, while maintaining backwards compat.

Attachments (1)

template-functions-post.php.diff​ (2.9 KB ) - added by MC_incubus 21 years ago.

Download all attachments as: .zip

Change History (7)

#1 @MC_incubus
22 years ago

  • Patch → No

#2 @MC_incubus
22 years ago

  • Patch No → Yes

#3 @ryan
22 years ago

What's the use case? Someone who doesn't want to echo would probably be using get_pages() so that they could do their own thing, yes?

#4 @MC_incubus
22 years ago

Well, the use case for me was that I wanted to use wp_list_pages() in a 'the_content' filter. Wrote a plugin that replaces <!--subpages--> with the list of pages under that current page (had a lot of requests for this).

So I need to be able to do a str_replace() to put in wp_list_pages() for <!--subpages-->

Yes, I could make a copy of the function, rename it, and modify it... but that seems silly when all I need is wp_list_pages() with a return instead of an echo.

#5 @ryan
22 years ago

  • fixed_in_version → 1.5.1
  • Owner changed from anonymous to rboren
  • Resolution 10 → 20
  • Status new → closed

This ticket was mentioned in ​Slack in #core-coding-standards by jrf. ​View the logs.


8 years ago

Note: See TracTickets for help on using tickets.