How to Create a Custom Archives Page in Wordpress


SUBMITTED BY: Guest

DATE: May 4, 2014, 10:54 a.m.

FORMAT: Text only

SIZE: 2.0 kB

HITS: 813

  1. This is a good way to keep all of your content in one place. This is a tutorial about how to create one.
  2. This is a way of improving the visualization of older sites that have many posts in one day, over a couple of years
  3. ( wpbeginner.com for example ) . So these tips allow you to avoid clutter and improves user performance on your website.
  4. But, it`s too bad that not many themes have this ability.
  5. How to create one
  6. Create a page template – open a new file in your text editor ( i.e Notepad ) and name it page-archive.php. After this add the following codes at the top :
  7. 1 <?php
  8. 2 /*
  9. 3 Template Name: Archives
  10. 4 */
  11. 5 ?>
  12. Upload this into your WordPress themes folder. After this copy the connect of your page.php file and paste it in page-archive.php
  13. Example of how it would look like :
  14. 01 <?php
  15. 02 /*
  16. 03 Template Name: Archives
  17. 04 */
  18. 05 get_header(); ?>
  19. 06
  20. 07 <div id="primary" class="site-content">
  21. 08 <div id="content" role="main">
  22. 09
  23. 10 <?php while ( have_posts() ) : the_post(); ?>
  24. 11
  25. 12 <h1 class="entry-title"><?php the_title(); ?></h1>
  26. 13
  27. 14 <div class="entry-content">
  28. 15
  29. 16 <?php the_content(); ?>
  30. 17
  31. 18 /* Custom Archives Functions Go Below this line */
  32. 19
  33. 20
  34. 21
  35. 22 /* Custom Archives Functions Go Above this line */
  36. 23
  37. 24 </div><!-- .entry-content -->
  38. 25
  39. 26 <?php endwhile; // end of the loop. ?>
  40. 27
  41. 28 </div><!-- #content -->
  42. 29 </div><!-- #primary -->
  43. 30
  44. 31 <?php get_sidebar(); ?>
  45. 32 <?php get_footer(); ?>
  46. Now your basis page template is ready, you need to create a new custom archives page in Wordpress. Click Pages -> New . You can call if how you like ( i.e Archives, Library, Whateva )
  47. Below the publish button you will see Page Attrivutes. Click on the menu below Template and choose Archive as you page template. Save and Publish then .

comments powered by Disqus