Custom Post Type and Filter by Year

3 posts in this topic

Hello all

I have created a Custom Post Type - this shows all posts of the news room CPT which is what I want - shows all news room posts of the news release category which is what I want


There are hundreds of posts of news release category, so my question is how do I create a filter that allows visitors to filter by year?  


The perfect solution would be when someone goes to:


and see's all of the posts of the news release category, they can click buttons or links (2005, 2006, 2007, 2008, etc) and the page would remove all the posts except for the posts of that year.


Anyone have any ideas on how to facilitate this please?

Thank you all in advance


Share this post

Link to post
Share on other sites

Thanks Simon.....I tried that link this morning.....unfortunately it didn't work.  But I'm not very good with PHP yet.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • Can't get filter to remove <br> before <input> tag
      By evscicats+
      I am trying to remove a <br> tag that is appearing before a submit button on my website.  The reason I want to get rid of the break is because the button is not staying perfectly inline with the select menus.  Here's the link to the custom taxonomy page where I'm having the issue.
      I have tried the following filter in my child theme functions.php file but it doesn't work.  Maybe I'm not calling the right hook?  
      Any help is greatly appreciated!
      add_filter('pagelines_page', 'remove_bad_br_tags'); function remove_bad_br_tags($content) { $content = str_replace('<br /><input', '<input', $content); return $content; } Thanks,
    • Custom Post Types Help
      By atcdomainsolutions+
      Hey everyone. I'm building a site for an attorneys office and they have a huge staff and I know the best way to input everyone is by creating Custom Post Types. In the years I have built sites, I have never created a cpt... Haha. Well, I have with plugins but the one thing I do not know how to do is get them to display. I'm using the Skeleton child theme and would love if someone would be willing to walk me through how to get cpt's created with a plugin to actually be displayed.
    • Google Maps: get Locations from CPT
      By Dominik+
      Is it possible to add a function to the google maps section to get the Locations from a Custom Post Type?
      I have a cpt called hotels with fields: google maps address, google maps title, google maps description
      for the single hotel view i could use the fields with the maps shortcode to display the map fine.
      i want the google maps section to display all entries of the cpt on one map in the hotel overview (archive page) 
      i should lode the, address, title and description from the cpt.
      nice add-on would be possibility to select the custom taxonomies to display
      Or is outthere a plugin possible doing this all?
    • How to use pl-area-inner-classes and pl-area-inner-style filters
      By rsmm+
      I've figured out how to use these filters. But I can't figure out how to isolate a single area instead of applying the filter to all the areas.
      add_filter('pl-area-inner-style', function($style){   $style .= "background: #f90;";   return $style; });   add_filter('pl-area-inner-classes', function($classes){   $classes .= " amazing-class";   return $classes; });  
      I feel like I must be missing something obvious. And I don't know nearly as much about filters as I probably could. Anyone have any ideas?  
    • Masonic Gallery - filter show only certain post category or tag
      By strawberryhill
      Hi is it possible to make the Masonic Gallery show only posts belonging to a certain category or with a certain tag? I want my gallery to display posts with tag or category work not all my posts. Or if possible to show only certain pages.
      Kind regards