Skip to main content
7 votes
Accepted

wp_get_archives: Put span inside anchor tags

Span outside anchor tags I think you're looking for the before and after arguments (PHP 5.4+): wp_get_archives( [ 'before' => '<span>', 'after' => '</span>' ...
birgire's user avatar
  • 67.4k
3 votes
Accepted

Replace Archive Widget Link Text

You can use regular expression and the preg_replace_callback() function: function _make_khmer_link_replace_callback( array $matches ) { return '<a' . $matches[1] . '>' . ...
Sally CJ's user avatar
  • 39.3k
3 votes
Accepted

Multiple filters for wp_get_archive

Make use of custom parameter, lets call it wpse__current_year, which will accept two values, true (includes current year) and false (excludes current year). Lets incorporate that function ...
Pieter Goosen's user avatar
2 votes
Accepted

How to replace a javascript select box onchange event to a form submit action?

It's not working because: You are redirecting home You don't listen for the $_GET variable so the archive link is just appended to your home url You need to add a function that listens for that $...
bynicolas's user avatar
  • 2,279
2 votes
Accepted

How to list articles by year based on url?

Avoid using query_posts() Please don't use query_posts('posts_per_page=10'); in your date.php template file as it will override the main query instance and thus affect the main loop. This can ...
birgire's user avatar
  • 67.4k
1 vote

How to get post archives urls list without any markup?

I was going to suggest creating a regex to parse it but if you look at this comment on the Wordpress wp_get_archives() docs it looks like someone has gotten there before us.
Bob's user avatar
  • 194
1 vote
Accepted

wp_get_archives doesn't take effect from css or html

Solution : "Add 'echo' => false, to the arguments array!" by @bcworkz different wp forum
Dejan Arsenijevic's user avatar
1 vote

What do I need to style for the page after wp_get_archives?

According to the Template Hierarchy, archives are usually displayed using the theme's archive.php file, although other template pages might be used instead (see the image on that page). So, you ...
Rick Hellewell's user avatar
1 vote
Accepted

get the custom post type title/name

You can use post_type_archive_title( $prefix = '', $display = true ): <h1><?php post_type_archive_title() ?></h1>
TheDeadMedic's user avatar
  • 36.5k
1 vote
Accepted

Custom link text wp_get_archive link

I think the simplest way would be to use the get_archives_link filter. For example: add_filter ('get_archives_link', function ($link_html, $url, $text, $format, $before, $after) { if ('with_plus' ...
Andrew Dinmore's user avatar
1 vote

wp_get_archives() - Get CSS selector for current month

As of WordPress 5.3, <a> elements generated by wp_get_archives (etc) for links to the current page have the attribute aria-current="page" added to them. If you just want to style the ...
Peter Charlton's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible