• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Create an archive page listing of articles in WordPress sorted by date

By Abhishek Ghosh March 11, 2011 8:38 pm Updated on November 8, 2014

Create an archive page listing of articles in WordPress sorted by date

Advertisement

This tutorial discusses a method to automatically create an archive page in WordPress showing all your articles chronologically by dates.

 

Create an archive page listing in WordPress by date in WordPress

 

Recall that, WordPress by default shows archives by month.

 

To implement this chronological archival page, we will suggest you to use a separate page template to avoid changing your theme. However, you may directly take the challenge to change the standard archive.php file.

Advertisement

---

 

Building the model of a WordPress page

 

Code might be faulty due to Crayon Syntax Highlighter’s over work. Please debug.
Additionally, this is very old post. There are good plugin for this work.

In your theme folder, duplicate the page.php file for reuse the HTML structure of your site. Rename the file for convenience. You might know, we already wrote how to create a PHP file in Windows 7 without any software.

 

Paste in the first instance these initial lines of code there by telling it is a WordPress template. First add PHP opening.

Then, just after the command php the_content insert this:

Vim
1
2
3
4
5
6
7
8
<? php
previous_year $ = $ year = 0;
$ month = $ previous_month = 0;
$ ul_open = false;
$ my posts get_posts = ('number posts =- 1 & orderby = post_date & order = DESC');
?>
<? php foreach ($ my posts as $ post):?>
<? phpsetup_postdata ($ post);$ Year = mysql2date ('Y', $ post-> post_date); $ month = mysql2date ('n', $ post-> post_date); $ Day = mysql2date ('j', $ post-> post_date); ?> <? php if ($ year! Previous_year = $ | | $ month! = $ Previous_month)?> <? Php if ($ ul_open == true)?> </ul> <? Php endif;?> <h3> <? php the_time ('F Y');> </ h3> <ul> <? php $ ul_open = true;?> <? Php endif;?> <? Php $ year = $ previous_year; previous_month $ = $ month;?> <li> <span> <? php the_time ('F j');> - </ span> <span> <a href = "<? php the_permalink () ?>"><? php the_title (); ?> </ a> </ span> </ li> <? Php endforeach;?> </ ul>

 

Remember to save the file on your server via FTP in the /wp-content/themes/YOUR_CURRENT_THEME/

 

Publication of the chronological archive page

 

Then log into your WordPress admin and then apply the page template we just created.

You can; for example, create a page named Archive. In the Page Attributes module, select Archive (or what ever the name you used to save the page template) as model:

 

Create an archive page listing in WordPress by date

 

Note: You may need to modify the method for themes which uses own or modified platform.

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Create an archive page listing of articles in WordPress sorted by date

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • Changing Data With cURL for OpenStack Swift (HP Cloud CDN)

    Changing Data With cURL For Object is Quite Easy in OpenStack Swift. Here Are Examples With HP Cloud CDN To Make it Clear. Official Examples Are Bad.

  • PHP Snippet to Hide AdSense Unit on WordPress 404 Page

    Here is Easy PHP Snippet to Hide AdSense Unit on WordPress 404 Page to Avoid Policy Violation and Decrease False Impression, False Low CTR.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Comments

  1. AvatarPulkit Kaushik says

    September 13, 2011 at 8:36 pm

    You need to make your posts more reader friendly. I didn’t understand where to find the_content. Try to be more elaborate next time.

  2. AbhishekAbhishek says

    September 13, 2011 at 10:56 pm

    You will find

    the_content

    within

    the_loop

    . You will get reference of both in WordPress Codex.

    You are using Elefolio Premium Theme from Woo Themes. Woo Themes uses generic loops. Please contact Woo Themes’ support mentioning this post, they will guide you how to add it.

  3. AvatarChristian says

    March 7, 2012 at 10:36 am

    Although useful, you have made a mockery of the copy/paste by forcing your website credits into the copied text. No one in their right mind would type out the code you have provided.

  4. AbhishekAbhishek says

    March 7, 2012 at 11:55 am

    Christian, we understand its a big problem now for the nice innocent users for copying the code parts in guides.

    The idea of enforcing url copyright text was to fight the copy-paste bloggers, your comment gave a nice feedback and we will try to exclude the code parts as soon as possible those are getting in to the codes too. Its not only impossible to type out the code as rightly said by you, but also there is a possibility of getting errors if those are not sanitized / chopped out by the new users, specially for php and .htaccess codes.

    Again thank you very much for the feedback.

  5. AvatarYogesh says

    October 13, 2012 at 12:20 pm

    Thanks for this tutorial. When I applied for socialpark, I got rejected just because my blog was not having chronological archive. With your article my blog was approved. Thanks for sharing.

  6. AbhishekAbhishek says

    October 14, 2012 at 6:23 pm

    Congrats. Thanks a lot for reporting it back.

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Market Segmentation in BriefSeptember 20, 2023
  • What is Booting?September 18, 2023
  • What is ncurses?September 16, 2023
  • What is JTAG in Electronics?September 15, 2023
  • iPhone 15 Pro Max Vs Samsung Galaxy S22/S23 UltraSeptember 14, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy