Because she’s #ds106 #4life and an awesome grandma…

I do have one of these on CogDogBlog- mainly because I wanted a reference way to be able to grab the links to my own posts when I write new ones. The way I did it is a bit arcane (especially since I did it like 4 years ago), but here is a method that should work for anyone with a self hosted WordPress site.

(1) Make a copy of your template’s page.php file and name it something like page-last100.php.

(2) At the very top, above everything else add:

Doing this allows this to appear as am optional template in your WordPress Page editor.

(3) In this file, find the part where it reads:

Newer templates might have something like

The point is you will be able to put whatever introduction you want into a page you will create; and we will add after it the code to run through your last 100 posts.

(4) Just below the area you found in the above step, add this php code. What it does is run a new database query to find the last 100 posts, and echo a list of them.

For added flair, my code puts a little pencil icon on the link that gets you to edit the post (this will appear only for logged in users with edit capabilities). To get the pencil, just create a directory in your theme file called “images” (if it does not exist already), and download my pencil graphic and put in that directory.

(5) Upload this to your active wordpress theme directory.

(6) Create a new WordPress Page- give it ant title you like, and write what you want to be as the introduction to the page:

page latest

(7) On the right side, under the box for Page Attributes, select Last 1oo Posts under the Templates menu.

(8) Publish

You should get something like this version of my last 100 posts page .Mine has a few bits of post content stuff (the creative commons statement, and social sharing) which would take a more advanced lesson to overcome. But this should provide some insight how you can change page templates.

Profile Picture for Alan Levine aka CogDog
An early 90s builder of the web and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person.

Leave a Reply

Your email address will not be published. Required fields are marked *