Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#20464 closed feature request (wontfix)

Page for Archives

Reported by: rabinbs Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: close
Focuses: Cc:


Using WordPress as a CMS requires this feature where we can set a "page" as a "homepage" for an archive(like category or tags). Say we have a category named music and when people visit "/category/music" they should see a page created for this category instead of list of posts. This should be an optional feature and if no page is set for an archive then the user gets traditional list of posts. A plugin named cat2page was doing this but it is completely dead now and there is no other patch for this.

Change History (7)

#1 @ocean90
6 years ago

You should create a template for your category archive, see http://codex.wordpress.org/Category_Templates.

#2 @Ipstenu
6 years ago

You could adjust your theme and use category-music.php as your custom page. True, it's not editable by WP, but that's the normal way to make a 'custom category archive page.'

The example here is pretty much it, though it uses category-ID.php and not category-SLUG.php: http://codex.wordpress.org/Template_Hierarchy#Examples

#3 @rabinbs
6 years ago

Yes this can be achieved by the category_templates but that is not the WordPress way.

Here is how I'm doing this the WordPress way for now.

I made a single post for every category and saved it as draft so that this page is not accessible anywhere else. Then pulling this post on the archive page category.php like /category/music/

the code I'm using to pull it is

  $cat = get_query_var('cat');
    'showposts' => 1,
    'category__in' => array($cat),
    'post_status' => 'draft'
  if ($posts) {
    foreach($posts as $post) {
      setup_postdata($post); ?>
      <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
      rest of the content

Now whenever a user visits the /category/music page it shows up the draft post and I can manage it the WordPress way.

We have to wait untill some brilliant coder patches it and publish some real solution.

#4 @rabinbs
6 years ago

Can somebody please improve this code so that it can conditionally check if there is any draft post for this category or not? If there is a draft post then show it otherwise the traditional category archive.

#5 @ocean90
6 years ago

  • Keywords close added

Templates are one the main features of WordPress, it's "the WordPress way".

To get help you should try the support forum: http://wordpress.org/support/

#6 @greenshady
6 years ago

Just create a custom category.php. Then, display the category description for your category "content".

#7 @SergeyBiryukov
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.