Jump to content


Photo
- - - - -

How to create a custom archive page for back issues


  • Please log in to reply
5 replies to this topic

#1 dugoni

dugoni

    Advanced Member

  • Members
  • 58 posts
  • Country: Country Flag

Posted 26 October 2011 - 10:36 PM

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:

Please Login or Register to see this Hidden Content

And here's a sample individual back issue archive page:

Please Login or Register to see this Hidden Content

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?

#2 kastelic

kastelic

    Advocate

  • Members

  • 3081 posts
  • Country: Country Flag

Posted 26 October 2011 - 11:53 PM

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

Please Login or Register to see this Hidden Content


You can do a wordpress conditional like this:

Please Login or Register to see this Hidden Content


This is what the basic wordpress loop looks like :

Please Login or Register to see this Hidden Content

You can read more about that here:

Please Login or Register to see this Hidden Content



#3 dugoni

dugoni

    Advanced Member

  • Members
  • 58 posts
  • Country: Country Flag

Posted 27 October 2011 - 08:18 PM

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()): ... ?

#4 dugoni

dugoni

    Advanced Member

  • Members
  • 58 posts
  • Country: Country Flag

Posted 27 October 2011 - 09:02 PM

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?

#5 kastelic

kastelic

    Advocate

  • Members

  • 3081 posts
  • Country: Country Flag

Posted 27 October 2011 - 09:02 PM

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:

Please Login or Register to see this Hidden Content


At any rate, I highly recommend you check out this video which explains the wordpress loop better than anywhere i've seen:

Please Login or Register to see this Hidden Content



#6 dugoni

dugoni

    Advanced Member

  • Members
  • 58 posts
  • Country: Country Flag

Posted 31 October 2011 - 06:50 PM

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()):...