Opened 13 years ago
Closed 13 years ago
#25558 closed enhancement (duplicate)
Smarter get_template_part() function
| Reported by: | Horttcore | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Template | Version: | |
| Severity: | normal | Keywords: | 2nd-opinion has-patch |
| Cc: | Focuses: |
Description
The get_template_part() function could be much smarter if it takes any number or arguments.
function get_template_part() {
$partials = array_filter( func_get_args() );
do_action( "get_template_part_{$slug}", $args[0], $args[1], $args ); // $args[1] for compability
$templates = array();
if ( $partials )
foreach( $partials as $partial ) {
$templates[] = implode( '-', $partials ) . '.php';
array_pop($partials);
}
locate_template($templates, true, false);
}
Attachments (1)
Change History (6)
#1
@
13 years ago
- Milestone Awaiting Review
- Resolution → duplicate
- Status new → closed
- Version trunk
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Duplicate of #21676. Also, oddly, your patch looks reversed.