Hi Ashley,
I’m trying to limit my archives to single category (“blog”) only but unfortunately I can’t make it. I was trying method from FAQ as well as exluding category (topic found here in support) but neither of these works.
I don’t know if something changed due to updates or am I doing something wrong. Some help will be highly appreciated! Code I dropped into functions.php :
add_filter('expanding_archives_get_posts', function(array $args) {
$args['cat'] = blog; // Replace with ID of your category.
return $args;
});
add_filter('expanding_archives_query', function(string $query) {
$category = get_category(blog); // Replace with ID of your category.
if (! $category instanceof \WP_Term) {
return $query;
}
global $wpdb;
return "
SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year, COUNT(id) as post_count
FROM {$wpdb->posts}
INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id AND {$wpdb->term_relationships}.term_taxonomy_id = blog)
WHERE post_status = 'publish'
AND post_date <= now()
AND post_type = 'post'
GROUP BY month, year
ORDER BY post_date DESC
";
});
There are still all posts from all categories visible.
Thanks!
Jakub
]]>Hi,
I need to exclude some specific posts from the archive (or a whole category if it’s simpler). Is there a way to do this with a filter ?
Since you rewrote the code, I can’t make sense of it any more! Sorry.
Thanks for your help, and for a great plugin.
RP
]]>Hi Ashley,
Thanks for developing this great plugin! I am using the Japanese version. When I expand the year, unnecessary bullet points appear between each month (please see the sidebar here). I was wondering if there was a way to remove these bullet points.
Also, there is a lot of space between each month and post count. Is there a way to improve the appearance so that instead of
“+7月 (1)”
we can have something tighter like
“+7月 (1)”
Thanks in advance for your help!
Kenji.
]]>Hi,
I have a website in both English and Spanish languages, and I am using Polylang plugin to manage the content. When the Archives Widget posts are expanded, whatever is the language, all of them, in both languages, are displayed. So, I wonder if it’s possible to display only the posts for each respective language.
Thank you so much and congratulations for such a great plugin ??
Hi,
First of all I love your plugin !
I wanted to know if you can tell me if it is possible to edit the code to show only archives from a specific category.
I already tried to add a filter to a specific category in the Month.php file (by adding it to the args) but it’s always showing all posts.
Can you help me about that please ? Thanks !
]]>Hello,
I just updated Expanding Archives to version 2.0 on my staging site and it appears to be only working half way.
Expanding prior years does work and shows the months of the year where posts were created. However, expanding the months to drill down to the individual posts is NOT working, so I can’t see the archived posts.
I installed the Transient Manager plugin and deleted expanding_archives_months
but that did not work.
Can you tell me what’s going on? Thank you.
]]>Posts are listed in archives for current and previous year, however under 2019 only the last 3 months are displayed even though there are older posts?
]]>I want to replace an older plugin that is still working, but was abandoned by the author a couple of years ago. I like your plugin, but it hasn’t been updated in awhile and doesn’t say it is compatible with latest WP versions. Is it working well for people on newer WP versions?
Thank you!
]]>Hello,
I installed your plugin last week (month of July) and it works perfectly. I have it functioning and styled with CSS just the way I want. It shows the year (2020) and month (July) with the correct number of posts for July (8).
However, today (August) I created two new test posts. They are not showing up in the archive. I was expecting to see the Month “August” show right above “July” but it’s not there.
I’m using Elementor Pro with a child theme of Hello Elementor’s plain vanilla theme.
WordPress 5.4.2 with PHP 7.4.1.
]]>I’d like to use this style: https://ps.w.org/expanding-archives/trunk/screenshot-1.png?rev=2178716
what’s the code, so I can add it
]]>How do I change the font style for the year and months?
]]>Can someone share how to change the colors of the following:
– Title hover color
– Entries in the list color
– Entries in the list hover color
I am familiar with where to make the changes, I’m just particularly familiar with CSS.
Thank you.
]]>Please tell me if it is possible with the help of your wonderful plug-in to organize archives not by years but by decades?
]]>Only when I’m not logged in… Using the sidebar widget on the front-end, trying to expand a month I end up with a stuck loading icon. The console is reporting: “Failed to load resource: the server responded with a status of 403 () … /wp-admin/admin-ajax.php:1”;
This is only happening when I am not logged into WordPress. If I’m logged in it works as expected.
Any ideas? Thanks!
]]>Hi,
Your plugin is great and I use it on all my sites (with some creative CSS ;-), but I’ve hit a snag: I have a custom post type that I’d like to have appear in the archives, and I can’t find an easy way to do this.
Any suggestions?
Thanks,
RP
Hello!
This great plugin is not working properly. WP is running version 5.2.2 and PHP-version is 7.2 or 7.3. I disabled all the other plugins and tried with GeneratePress theme, the expanded archives were empty.
With TwentyNineteen it works, but unfortunatelly it really is not an option.
Any plans to update the plugin?
]]>Hi!
Is it possible to get list of posts direcly when you click the year? I don’t need to show month list at all..
Also, how can I get only one (the selected) year open at once?
]]>Hi @nosegraze,
I use your plugin and it’s very useful. Congratulations!
My blog have almost 7.000 posts and the ‘Archive‘ page takes a while to load.
When a visitor clicks on a link he is redirected to a post but in the same tab/window.
I’d like visitors to be redirected to a new blank tab to avoid carrying a new loading of that ‘Archive‘ page.
How do I use target = "_ blank"
in all links on that ‘Arquive‘ page?
Thanks in advance.
]]>is there a way to reverse the order of the posts … ascending / descending
]]>Hi,
thank you for this fantastic plugin!
Is there a way to autoshow all posts of the actual month?
Best Regards
Hubert
I have a large blog of some 13,000 entries. I have just done a batch addition of 137 entries for 1974… but they don’t seem to show up in the expanding archive for 1974. Similarly some entries for months in other years don’t seem to expand. I’m sure it is a problem with the way in which I have entered these – but at the moment everything else seems to work perfectly. Can you give me any clues as to which fields in the database are used to create the index… then I can check whether they have been set correctly. (I would have thought – Published Date, and Title, and possibly URL)
]]>Hi,
just curious as to how expensive this query is?
$months = $wpdb->get_results( "SELECT DISTINCT MONTH( post_date ) AS month , YEAR( post_date ) AS year, COUNT( id ) as post_count FROM $wpdb->posts WHERE post_status = 'publish' and post_date <= now( ) and post_type = 'post' GROUP BY month , year ORDER BY post_date DESC" );
Given that the result of this query will change rarely, would there be any advantage in push / pulling it from a transient, instead of re-executing it on each page load that contains the widget? Just a thought…
cheers,
Hugh
Would it be possible to specify a category for post archives? We basically, we just want a specific category archives to show up. We would like to control this on a per-widget basis. We are thinking of having 2 instances of the archive widget on two different sidebars.
Thanks!
]]>Hi Ashley,
First, thanks for this amazing and easy to use plugin, I’m recommending it for all my themes.
I’d like to know if there’s a simple tweak to close the current year list by default, I can edit PHP but I’m not sure what to look for.
Thanks!
]]>Hello,
How can I change the color of border?
Thanks.
]]>Hi,
I don’t have any sort of monthly archive pages set up; the plugin shows a matching URL in the href for each button bar. Although these links are not ‘clickable’ by users (as the JS intercepts the click and turns it into an AJAX call to retrieve the post list) these links are still search-visible, resulting in a lot of 404 errors when the site is indexed. Perhaps they could be optionally hidden?
cheers,
Hugh
Hi there,
I changed my theme recently and I noticed that the Expanding Archives widget isn’t displaying correctly:
The widget is in the footer. I think it is picking up the cuss from the theme instead of the plugin and that means it doesn’t look right. I have tried uninstalling and reinstalling the plugin but this hasn’t helped.
Can you suggest anything to help?
Thanks,
Hazel
I’m sure this is probably something that I have done but when I try to install the Expanding Archives widget it tells me that it would not activate due to a fatal error and gives me this:
Parse error: syntax error, unexpected T_FUNCTION in /home/content/70/8898470/html/wp-content/plugins/expanding-archives/inc/widget-expanding-archives.php on line 145
I took a look at it to see if I could see what it was referencing but I don’t dare mess with code. Can you tell me what it is I’ve done?
Thanks!
]]>