Archive a news story

Home Forums GovIntranetters Archive a news story

Viewing 4 reply threads
  • Author
    Posts
    • #3189
      Natalie Smithson
      Participant

      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!

    • #3190
      Luke Oatham
      Keymaster

      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?

    • #3191
      Natalie Smithson
      Participant

      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?

    • #3193
      Luke Oatham
      Keymaster

      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.

    • #3353
      Matthew Jasek
      Participant

      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’

Viewing 4 reply threads
  • You must be logged in to reply to this topic.