wp_get_archives() – Displays archive links based on type and format.
You appear to be a bot. Output may be restricted
Description
Displays archive links based on type and format.
Usage
$void|string = wp_get_archives( $args );
Parameters
- $args
- ( string|array ) optional – { Default archive links arguments. Optional.
- $type
- ( string ) optional – Type of archive to retrieve. Accepts 'daily', 'weekly', 'monthly', 'yearly', 'postbypost', or 'alpha'. Both 'postbypost' and 'alpha' display the same archive link list as well as post titles instead of displaying dates. The difference between the two is that 'alpha' will order by post title and 'postbypost' will order by post date. Default 'monthly'.
- $limit
- ( string|int ) optional – Number of links to limit the query to. Default empty (no limit).
- $format
- ( string ) optional – Format each link should take using the $before and $after args. Accepts 'link' (`<link>` tag), 'option' (`<option>` tag), 'html' (`<li>` tag), or a custom format, which generates a link anchor with $before preceding and $after succeeding. Default 'html'.
- $before
- ( string ) optional – Markup to prepend to the beginning of each link. Default empty.
- $after
- ( string ) optional – Markup to append to the end of each link. Default empty.
- $show_post_count
- ( bool ) optional – Whether to display the post count alongside the link. Default false.
- $echo
- ( bool|int ) optional – Whether to echo or return the links list. Default 1|true to echo.
- $order
- ( string ) optional – Whether to use ascending or descending order. Accepts 'ASC', or 'DESC'. Default 'DESC'.
- $post_type
- ( string ) optional – Post type. Default 'post'.
- $year
- ( string ) optional – Year. Default current year.
- $monthnum
- ( string ) optional – Month number. Default current month number.
- $day
- ( string ) optional – Day. Default current day.
- $w
- ( string ) optional – Week. Default current week. }
Returns
void|string Void if 'echo' argument is true, archive links if 'echo' is false.
Source
File name: wordpress/wp-includes/general-template.php
Lines:
201 to 219 of 219
if ( $result->post_title ) { /** This filter is documented in wp-includes/post-template.php */ $text = strip_tags( apply_filters( 'the_title', $result->post_title, $result->ID ) ); } else { $text = $result->ID; } $selected = get_the_ID() === $result->ID; $output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected ); } } } } if ( $parsed_args['echo'] ) { echo $output; } else { return $output; } }