I have a custom post type “contest_recipe”. I can view contest recipe posts by year and by date with the following urls:
http://example.com/2011/?post_type=contest_recipe - shows all 2011 contest recipes http://example.com/2011/7/?post_type=contest_recipe - shows all July 2011 contest recipes
I would like to simplify the url to
http://example.com/2011/recipes http://example.com/2011/7/recipes
Is this possible?
I am not familiar with the rewrite rules concept. Can anyone recommend a tutorial on how to learn about this or provide an example?
I used this to enable yearly and monthly archive for custom post type. Just drop in this code into your
functions.php
file.This will add your custom rule right on the top of the Rules array. NB – WordPress uses rules array to store rewrite rules.
Resource –
rewrite_rules_array
( Useful to generate even more combinations )