Make WordPress Core

Opened 20 years ago

Closed 20 years ago

Last modified 6 years ago

#1270 closed enhancement (fixed)

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

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

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 20 years ago.

Download all attachments as: .zip

Change History (7)

#1 @MC_incubus
20 years ago

  • Patch set to No

#2 @MC_incubus
20 years ago

  • Patch changed from No to Yes

#3 @ryan
20 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
20 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
20 years ago

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

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


6 years ago

Note: See TracTickets for help on using tickets.