Archive a news story
Home › Forums › GovIntranetters › Archive a news story
- This topic has 4 replies, 3 voices, and was last updated 6 years, 11 months ago by Matthew Jasek.
-
AuthorPosts
-
-
16 Aug 2017 at 13:45 #3189Natalie SmithsonParticipant
How do I archive a news story? I’ve got the WordPress Custom Post Type Archive plug-in, I’ve got the widget to appear on the news landing page (I’ve got a news archive page), but I can’t seem to work out the last bit – the actual archive of a news story and how to get it to appear in the widget area. What am I missing!
-
16 Aug 2017 at 16:36 #3190Luke OathamKeymaster
The plugin is a simple method of giving access to archive listings via a dropdown menu of years, but doesn’t actually “archive” anything. We have since stopped using the plugin after finding security vulnerabilities a while back.
Are you looking for a way to clear down old stories?
-
17 Aug 2017 at 08:45 #3191Natalie SmithsonParticipant
We’ve got the expiry dates set to help manage the content, the question that came up was if there was another way of organizing current stories rather than one long newsfeed as the number of stories grows. Fair point about security though, should we remove this plug-in from the site?
-
24 Aug 2017 at 17:57 #3193Luke OathamKeymaster
Yes I would stop using the archive plugin. But you’re relatively protected within an intranet, and unless you have a member of staff operating malevolently outside of the civil service code, I wouldn’t say this was high risk.
I’ve been reading research showing that staff rarely trawl back through news archives, and some intranets have removed “News” as a main option. However, for continuity or filling in background information for a particular story or campaign, categorisation and tags can help.
You can use news type, tags and teams to categorise news. Staff will be able to navigate archives by type or tag, and individual news stories will highlight recommended stories based on similar categorisations. You can use the feature news widget to highlight different flavours of news on the homepage, or the aggregator template can showcase news by team.
-
30 Jan 2018 at 10:12 #3353Matthew JasekParticipant
Old post but someone may find this of use. If you want to display monthly archives of a custom post type (news) then you can use the following code.
Add this to your functions file
function my_custom_post_type_archive_where($where,$args){ $post_type = isset($args['post_type']) ? $args['post_type'] : 'post'; $where = "WHERE post_type = '$post_type' AND post_status = 'publish'"; return $where; } add_filter( 'getarchives_where','my_custom_post_type_archive_where',10,2);
Then where you want to call the archive list use this code (archive.php sidebar in my case):
<?php $args = array( 'post_type' => 'news', 'type' => 'monthly', 'echo' => 0 ); echo '<ul>'.wp_get_archives($args).'</ul>'; ?>
You can change the ‘type’ to ‘yearly’ if you want to list the posts by year rather than months.
If your outputted links are showing 404’s you will need to make some more modifications but this method works with the theme and permalinks set to ‘Post name’
-
-
AuthorPosts
- You must be logged in to reply to this topic.