• 0
Sign in to follow this  
Followers 0

How to create a custom archive page for back issues

Question

Posted · Report post

I'm posting this question again, because apparently the system thinks my question was answered completely and it wasn't. We've been working on an online version of our alumni magazine. We want to have a back issues archive page to list all issues, and also to customize the way individual issues are displayed. We've been using categories for the issues - Everything that's in a given issue is tagged "Issues" and then given a subcategory too - for example, "Fall 2011" Here's the main back issue archive: http://www.contactpoint.womeninit.net/backissue/ And here's a sample individual back issue archive page: http://www.contactpoint.womeninit.net/category/issues/fall-2011/ Each article in the magazine issue is a post. The issue itself is not a post. Each article is tagged "Issues" and "Fall 2011" (Or "Spring 2011"... you get the idea.) The reason I did it this way is so we'd have a hierarchy. We also may have occasional content that isn't from one of the published issues. So such a post might be tagged "Newsflash" or "Update" or whatever, but it will be outside the Issues "tree". So in theory, we could have an archive page that only covers subcategories of "Issues". I don't want to replace the normal archives format entirely (I'll want news items that didn't appear in the magazine to be available on our site too!) but I do want an additional archive format that supports what I'm trying to do. As you can see, I've actually been able to create something of an archive page, but it's only semi-automated - I manually put in the issue date and the cover image, and then use a shortcode that came with a plugin to list the articles in that issue. The plugin works by feeding it a category ID in the shortcode. I'm sure there's a better (and automated) way to do this. But how? Which of the many php files in the theme should I dare edit?

Share this post


Link to post
Share on other sites

5 answers to this question

  • 0

Posted · Report post

If you have the child theme activated, you can do quite a bit by simply editing template.postloop.php. You can have entire custom loops in here. For example, right below the line that says [code] // Start of 'The Loop' [/code] You can do a wordpress conditional like this: [code] if ( is_category(23) ) { echo "here is where my custom loop if its a category page for category id 23"; } else [/code] This is what the basic wordpress loop looks like : [code] [/code] You can read more about that here: http://codex.wordpress.org/The_Loop

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Thank you, that's a start, bute ... well, template.postloop.php is so much more complex. So this goes before the code that says... if(have_posts()){ while (have_posts()) : the_post(); if(!pagelines_show_clip($count, $paged) || is_admin()): ... ?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I have a feeling that I'm trying to target something further down in template.postloop.php. There must be some part of the file that says "If this is a page listing posts by category...". No?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I know its complicated.I hope i don't confuse you, but you could do 2 things here. YOu could put it before the code as you said. This would be creating an entire new loop (the third chunk of code i pasted). Or you could do it right here without making a new loop, instead modifying the loop: [code] if(have_posts()){ while (have_posts()) : the_post(); if ( is_category(23) ) { echo "here is where my custom stuff is page for category id 23"; } else if(!pagelines_show_clip($count, $paged) || is_admin()): ... ? [/code] At any rate, I highly recommend you check out this video which explains the wordpress loop better than anywhere i've seen: http://css-tricks.com/video-screencasts/91-the-wordpress-loop/

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

That worked wonderfully! I made some tweaks (moved the if statement up a step, and incorporated some code I found elsewhere to list the subcategories of the category I wanted). Am listing here as it might be helpful to somebody else in the same boat (and to me if I forget!) // Start of 'The Loop' if(have_posts()){ // tests to see if this is category 47. If so, then this page should loop through the subcategories of category 47 and display them if ( is_category(47) ) { wp_list_categories('orderby=id&show_count=1 &use_desc_for_title=0&child_of='.$cat); } else // end of this loop, move on and do the usual Pagelines stuff while (have_posts()) : the_post(); if(!pagelines_show_clip($count, $paged) || is_admin()):...

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
Sign in to follow this  
Followers 0