I’ve been looking for a plugin that limits the tags dislayed in the tag cloud by date. Basically, I want all tags from a certain date forward. I’ve searched current plugins and haven’t found anything that limits by date.
Doing some research, I think I just need to modify the following line from:
$tags = get_terms(
$args['taxonomy'],
array_merge(
$args,
array( 'orderby' => 'count', 'order' => 'DESC' )
)
); // Always query top tags
to:
$tags = get_terms(
$args['taxonomy'],
array_merge(
$args,
array( 'orderby' => 'date', 'order' => 'DESC' )
)
); // Always query top tags
in the wp_tag_cloud()
function, but I’m still missing how to limit by the date. Suggestions?
Thanks!
Well it’s not that it’s not possible it just means it will take some effort. I am able to use an SQL query that combines the posts, term_relationships and terms tables. This allows a tag or name to be associated with a post which was published on a particular date. This was the sql statement i used ->
If you are not familiar with SQL this basically means combine the three tables and show all columns that are published.
You can narrow this down to just the term and the date with the following ->
So you have some data you can work with to produce your tag cloud. If you want to specify a date range then use the following ->
Replace lwdev_ with your table prefix. Using some php and searching for a custom tag cloud method you will be able to use the sql to return all the terms, and then use some php to specify the date.
One thing to note if you do not GROUP BY the term name then you will get a list of the same terms associated with a different post date. If you do GROUP BY the name then it will choose the earliest post date.
Check the sql in phpmyadmin and test the query to tailor your results. Hopefully someone has written an easier way to do all this, you might need some custom php functions to get the desired effect but it seems possible, just laborious. Hope this in some way helps.
NOT POSSIBLE –
WordPress doesn’t store date information with the categories or tags, thats why we can not either sort them or limit them by their dates.
Also there is no such argument –
'orderby' => 'date'
forget_terms()
function.See the Codex documentation on Possible Parameters.