WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 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
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 9 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 MC_incubus9 years ago

  • Patch set to No

comment:2 MC_incubus9 years ago

  • Patch changed from No to Yes

comment:3 ryan9 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?

comment:4 MC_incubus9 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.

comment:5 ryan9 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
Note: See TracTickets for help on using tickets.