Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#7749 closed enhancement (fixed)

LOOP and return Request: Enable echo=0 and style=none for wp_get_archives

Reported by: nublooo's profile nublooo Owned by: ryan's profile ryan
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.6.1
Component: General Keywords: archives, wp_get_archives, echo archives has-patch, commit
Focuses: Cc:

Description

An option of formatting the output of wp_get_archives in a similar way as wp_list_categories, for use in PHP before echoing it.

Suggestion: add the query-string-style parameter "echo" as in wp_list_categories and wp_list_pages to the archives function.

Attachments (2)

7749.1.diff (2.5 KB) - added by ShaneF 16 years ago.
allow "echo" option. Default echo turned on
7749.diff (3.2 KB) - added by DD32 16 years ago.

Download all attachments as: .zip

Change History (9)

#1 @ShaneF
16 years ago

  • Keywords has-patch commit added

Your wish is our command. :)

@ShaneF
16 years ago

allow "echo" option. Default echo turned on

#2 @ShaneF
16 years ago

  • Owner changed from anonymous to ryan

#3 @ryan
16 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [8902]) Add echo option to wp_get_archives(). Props ShaneF. fixes #7749

#4 @michelwp
16 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Summary changed from Request: Enable echo=0 and style=none for wp_get_archives to LOOP and return Request: Enable echo=0 and style=none for wp_get_archives

JUST A MISTAKE : because return are in LOOP, the behaviour is not correct and not like than echo...

The better code must be for each loop and each end of loop in if/endif series :

if ($echo)	
						echo get_archives_link($url, $text, $format, $before, $after);
					else
						$output .= get_archives_link($url, $text, $format, $before, $after);			
				}
			}
			if (!$echo) return $output;

#5 @michelwp
16 years ago

Just a short add : normally one function - one output ... it is probably possible to set only one output (echoing) and the end-end of the function...

@DD32
16 years ago

#6 @DD32
16 years ago

attachment 7749.diff added.

  • Moves echo/return outside of loops

#7 @ryan
16 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [9333]) Move echo/return outside of loops. Props DD32. fixes #7749

Note: See TracTickets for help on using tickets.