Questions tagged [wp-get-archives]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
87 views

Active class with custom wp_get_archives HTML output

I use a filter on get_archives_link for the HTML output and I try to reproduce the default aria-current="page" attribute on the <a> tag when we are on the archive page. if ( ! ...
  • 5
0 votes
1 answer
81 views

Get an array of the number of post per year of a custom post type (Wordpress)

I have a custom post type called "papers", and, to feed a chart, I need an array of the number of posts per year that have posts. I've tried with wp_count_posts() but it just give me the ...
0 votes
0 answers
86 views

Archive Meta on Product Post Type

I am using a filtered search to provide end user the ability to browse either live/published Woocommerce product listings or archived product listings; however, I am running into an issue where I am ...
  • 1
0 votes
2 answers
408 views

How to get post archives urls list without any markup?

I'm using wp_get_archives but I cannot prepend any text inside the links. I want code like this: <a href="archive link">[my custom prepend] 2020<a/> But the 'before' option will prepend ...
0 votes
1 answer
1k views

How to list articles by year based on url?

Hie all, I am trying to list posts by year based on the provided url (for example: wordpressite.com/2004 - this should list all articles created in 2004), unfortunately all suggested methods from ...
  • 17
1 vote
1 answer
1k views

wp_get_archives() not working for my custom post type

I have my custom post type working, but I can't seem to get the archives working. Here is my code for getting the archives: <ul> <?php $args = array( 'type' => '...
0 votes
1 answer
198 views

wp_get_archives doesn't take effect from css or html

I'll try to keep it short. So basically I'm trying to add custom item to my menu which in this case is the archive dropdown list with months desc. Everything looks nice and clean but the output of ....
0 votes
1 answer
105 views

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

http://summitcoach.web.dmitcapstone.ca/ Just a development server for now, but on the blog page I have links for monthly archives but they go to some page I believe is date.php and I just want the ...
  • 1
0 votes
0 answers
325 views

How to create a completely functioning separate archive for posts from only 1 or 2 specific categories

I can't seem to find a complete way of resolving my issue. I've found parts, but it seems I'm the only one out there who has the issue I do. I have a web working with WP, and recently I've been asked ...
2 votes
1 answer
68 views

Replace Archive Widget Link Text

I'm trying to replace the Roman numbers in the Archive Widget link (and all other numbers) with Khmer (Cambodian) numbers. But while I do replace the link text with this code, it also replaces the ...
  • 245
5 votes
2 answers
1k views

wp_get_archives: Put span inside anchor tags

I know how it is possible to wrap HTML around anchor elements with the inbuilt arguments for wp_get_archives. Is there a way to alter the content of the anchors in order to add a wrapping span for the ...
  • 310
2 votes
1 answer
1k views

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

I have a small problem that probably has a very simple fix. I have been using the wp_get_archives() function to produce a dropdown select form. See the full code below: <form id="side-arch"> ...
  • 31
1 vote
1 answer
6k views

get the custom post type title/name

I'm using a custom post type and use this plugin to display my custom post type's archives, does anyone knows how to display my custom post type's name/title to the archive.php? Below is the archive....
1 vote
1 answer
1k views

Multiple filters for wp_get_archive

I need to display custom posts archives on a page in the following format: Monthly - Grouped by Month for the Current Year. Annually - Grouped by Year & Month for all previous years So I have ...
1 vote
1 answer
2k views

How to filter by date & a specific custom post type post-WP 4.4?

WordPress 4.4 introduced the ability to display date archives by appending /?post_type=custom_post_type to the end of the date url. i.e. localhost/2016/02/?post_type=news. I had assumed I could do: ...
  • 113
0 votes
1 answer
295 views

Adding a Meta to the wp_get_archives

I'm trying to add a meta to wp_get_archives add_filter('getarchives_where','my_archives_filter'); function my_archives_filter($where_clause) { if(!is_user_logged_in()){ return "WHERE ...
  • 848
0 votes
1 answer
2k views

Archive page for custom taxonomy grouped by month

I am working on archive page of custom taxonomy of custom post types. I need to show archives by month of particular taxonomy. For retrieving post in particular taxonomy by month. However, I have ...
  • 193
0 votes
1 answer
6k views

Get current title of archive.php

I want to get current title at file archive.php My code : if ( is_category() ){ echo "CATEGORY"; } else if( is_tag() ){ echo "TAGS"; } else if( is_author() ){ echo "AUTHOR"; } else ...
0 votes
3 answers
341 views

Make post title active

Hi I have a simple website that displays every post title in a list, I'm trying to change the active post title to be different when its being viewed. I have tried this but it's not working. <ul ...
0 votes
1 answer
3k views

Get archives as array

I'm looking for a way to get the values returned from wp_get_archives as an array, similar to get_categories. I need to do this to modify the post counters to use - [#] instead of (#). See my current ...
  • 1,131
2 votes
2 answers
6k views

Display only posts from referred category on date archive page

I am using wp_get_archive() in category.php. If I am on page of category=2 it should show my archives of only that category. However it is for all the categories. Following is the code for my ...
0 votes
1 answer
71 views

WordPress Archives Cause Looping

I am attempting to create an archives page that would have links to authors, categories, tags, etc. I would like it so that when the author, for example, is clicked, all their posts are displayed. ...
0 votes
1 answer
4k views

Custom link text wp_get_archive link

Im trying to create custom text for the archive links in my sidebar. Right now it prints it but it comes out as regular text - i'm trying to make the full text output into the link. so "+ Trip {...
  • 304
0 votes
1 answer
119 views

Echo there are no posts wp_get_archives

I'm using wp_get_archives to output my archives in a sidebar - but if there are no posts I would like to echo out 'there are no posts to show'. Is there a conditional statement or filter I can use? ...
  • 304
0 votes
0 answers
588 views

Archive sorted by month - separate

I was looking for my answer in this forum but without success (so far..). Case is following - I have a news page with sidebar that shows archive (last 12 months). I'm using following code: <?php ...
0 votes
2 answers
3k views

Show the post date using the wp_get_archives() function?

I have some doubt about the wp_get_archives() function In my website I have create the following page template that use the wp_get_archives() function to show the posts list: <?php /** ...
0 votes
0 answers
180 views

How to count the number of monthly archive?

<?PHP $num_cats = wp_count_terms('category'); echo $num_cats. '<br/>'; ?> I get the number of total categories from the above code. How can I get the total categories based monthly ...
3 votes
2 answers
3k views

Date archives for custom post type

I have seen many questions/posts regarding this, but have yet to find a decent solution. Basically I am trying to do what wp_get_archives does, but for a custom post type (personally I am unsure why ...
0 votes
1 answer
1k views

remove 2014 from wp_get_archives

we have wp_get_archives('type=monthly'); function that have a output like this: Archives by Month: January 2014 December 2013 November 2013 but I want style like a table that sorted by years: 2014 ...
  • 105
0 votes
0 answers
164 views

How to arrange different post categories in template

I'm playing with WordPress for sometime. In my website, there will be 3 possible categories for posts, like: 'offer', 'news' and 'about' (each category with individual content). My attempt is to ...
  • 101
0 votes
1 answer
560 views

Yearly Archive from a custom date metabox (Event Start Date)

I have created a custom post_type called (event) and here's the code // Register Custom Post Type Events function custom_post_type_events() { $labels = array( ...
  • 1
1 vote
0 answers
403 views

wp_get_archives custom function broken since upgrading to WP 3.7.1

I've upgraded a site I'm working on to the latest WP, but it appears the function I wrote for splitting wp_get_archives() into years is now broken and I can't find out why. I've turned on debugging, ...
  • 1,422
0 votes
0 answers
1k views

wp_get_archives(); Change output of link

Is it possible to edit the output of the wp_get_archives link at all? I'd like to prefix the link with a string. At the moment the output is something like url.com/2013/10 what I'd like it to do ...
  • 101
0 votes
0 answers
210 views

wp_get_archive for category returning different URLs on different but similar sites

I have this code on two different sites in the sidebar: <ul class="news"> <?php wp_get_archives('cat=2&show_post_count=true'); ?> </ul> and this code in the main content ...
0 votes
1 answer
5k views

Need some help with "the_widget()" function

I am trying to create code to display certain default WordPress widgets on my e-commerce site. I have 6 content boxes which display WordPress widgets: • Pages • Latest Posts • Archive (last ...
-1 votes
1 answer
403 views

Wordpress 3.6 - archive.php doesn't get triggered [closed]

I made a custom theme and just created an archive.php file. When I try to access http://localhost/wordpress/?m=201308 for example it just triggers my index.php template. The link was generated by ...
0 votes
1 answer
3k views

How to have Multiple Archives Widgets, one archive widget per category (in a different page)?

Please read the whole question before assuming this question is repeated. After one day of trying plugins and tutorials, I am convinced that there is no straightforward method of achieving what I am ...
  • 101
1 vote
1 answer
4k views

How we display Archives for specific categories

I just want to show Archives for special categories. For example i have categories abc,xyz. I just want to show Archives for xyz not for abc. Currently i am using code to display Archives is <ul&...
  • 330
3 votes
1 answer
527 views

wp_get_archives breakes Html5 validation

I have a issue with wp_get_archives because it breaks my Html5 validation. Inside validator I get this message: Bad value archives for attribute rel on element link: Not an absolute IRI. The string ...
0 votes
1 answer
1k views

Wrap the "show_post_count" between div

How can I wrap the "show_post_count" between a div? (from the wp_get_archives()) Do I need to edit the function for that? Or could I do something like this with pseudo css? <div class="...
user avatar
0 votes
1 answer
2k views

wp_get_archives() output

Iv got this code in my blog.php: <?php wp_get_archives( array( 'type' => 'monthly', 'limit' => 12 ) ); ?> It links to: /2013/01 My page only loads the header and footer - I think its ...
user avatar
3 votes
3 answers
5k views

Overriding wp_get_archives() apply_filters()

I have Googled for a while and I am not sure how is the best way to do this. In wp-includes/general-template.php I am looking at the function wp_get_archives() which has this line of code in: $where ...
3 votes
3 answers
4k views

wp_get_archives() - Get CSS selector for current month

I'm looking for how to get a class in the wp_get_archives functions to get the current month (when we are in a month archive) just like when we call wp_list_categories, the current category has a "....
  • 848
2 votes
3 answers
5k views

Post count per (day/month/year) since blog began

I'm looking to echo the number of posts per month since the blog began, and for months where there was no posts echo '0'. This is the output I want: January 1, February 3, March 8, April 3, ... ...
0 votes
1 answer
651 views

Shortcode for output of wp_get_archives displays at top of post

Why does the output of this function // One Recent Post function most_recent_post_shortcode() { return wp_get_archives( 'type=postbypost&limit=1&format=custom'); } add_shortcode( 'recent-...
  • 8,528
2 votes
1 answer
7k views

custom post types, wp_get_archives and add_rewrite_rule

I've searched to see if anyone came up with a solution to a peculiar problem I'm having but did not find anything that was close to what was happening in my case. I have two custom post types - let's ...
  • 151
1 vote
1 answer
358 views

Custom archives function

I'm working on building a custom archives page for my church's website. On my archives page I want to have last week's sermon shown at the top in a special box, followed by the future sermons and then ...
  • 57
17 votes
5 answers
37k views

Custom Post Type Archives by Year & Month?

How do you display the archives of a Custom Post Type by Year & Month?
  • 517
2 votes
1 answer
3k views

How to limit wp_get_archives to show months for the X years only

Can anybody show me how to set a limit on wp_get_archives to show archives by month BUT only those for the year 2010 and above - so the 2009 monthly archives are not shown on the sidebar archive ...
  • 21
0 votes
1 answer
2k views

Simplest Way to Build Custom Archives Page?

I am looking to create a page in Wordpress to output links to all of our posts from every month since we launched the blog. I have seen the archive.php template file in Wordpress, but this seems to ...
  • 540