0

I want to create a monthly magazine style website.

I can see the url for a month is something like this: www.magazine.com/mywebpage/2013/08

Suppose I want to create a custom page for each month, do I create static pages for each month?

If I do that, how do I display the static page when the user clicks on the date archive?

1 Answer 1

0

If you do not want to use the buildin archives, your best way of achieving this is to create a Page Template containing nearly the same code as the archive.php.

Also, add some post_meta to your static pages, containing the Year and Month of the posts you want to show.

In your page template, set up a custom query containing the restriction for the date, with the $args:

$args = array (
    'year' => get_post_meta( get_the_ID(), 'your_year_meta', true ),
    'monthnum' => get_post_meta( get_the_ID(), 'your_month_meta', true )
    'offset' => $offset,
    //...
);

Make the query as usual, and use the code from your archive.php to loop through the posts.

Also make sure that, if you want your posts paginated, you calculate the custom offset right, and this should be it :)

1
  • Thanks for this. I will work on this and get back. I did have a clarification. On a magazine site, do they use a template? Does it make sense to create static pages to customize each issue, e.g, january.html, feburary.html, etc.
    – nilanjan
    Commented Aug 9, 2013 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.