For a while now I’ve been meaning to get a list of all the posts I’ve written on this site. I’m conscious that there are a lot of articles that I’ve written that are buried in the archives of the Contar Media blog, and they may not get seen very much. So I’m making an effort to revive some of those articles and start to promote them more. But before I can promote them, I need a list.
In this article I’ll show you how to use a snippet of code to retrieve a list of all the Posts and Articles from your WordPress site. This only works for WordPress – if your website is built on another blogging platform these instructions won’t work (sorry!).
There’s no simple way to retrieve a listing of all your WordPress blog posts and pages. I wish there was!
The first thing I tried was going to my sitemap and seeing how it displayed the content.
This was helpful in that it displayed a list of my article URLs, but it didn’t show the titles. So it made me wonder if there was another option.
Thanks to Google, I discovered a post where someone explained how to do it. Their solution, while a little technical, was perfect for me.
Firstly, you go to this page where you’ll find some code to use.
You copy the entire ‘raw code’ and save it into a Notepad file (or any plain text .txt file). I called mine ‘Postlist.php’. When I saved it in Notepad, it actually saved it as a text file, so it was called Postlist.php.txt – I renamed it using Windows Explorer to remove the .txt part of the file.
Basically this file tells your website to execute a set of instructions, namely to produce a list of all the URLs on the site.
Next step is to get this file uploaded to your site. The simplest way to do this is via your site control panel. In the Control Panel you’ll have a program called File Manager. Use this program (it’s like Windows Explorer) to navigate to the root folder of your website. You’ll know you’re in the right place if you see files like Default.html and Index.php.
Simply upload your Postlist.php file to this directory.
Once it’s uploaded, you’re ready to run the file. Go to your internet browser and type in www.YourSiteName.com/postlist.php (replacing your site details and also the name of your php file if you’ve called it something different).
If all goes well, you’ll see a screen like this one.
It’s set up with three columns:
- The first column tells you if it’s a post or a page.
- Column 2 is the URL.
- Column 3 shows the page title.
Next, I selected all this text and copied it (ctrl + C). I then pasted it into a Notepad document and saved this as a text file.
Now, I want to get this into a usable format so that means getting it into Excel. Open up Excel and go File / Open and make sure Excel is searching for all file formats, not just Excel files. Find the .txt file you just saved and select it. This should open up the Excel Text Import Wizard.
Select the ‘Delimited’ radio button and click ‘Next’.
If you leave the settings as they are, you should see a screen like the picture above. Excel is sorting out the data in the file into separate columns.
Hit the next button to be taken to a third screen where it asks you about formats for the fields – just accept the defaults here – and then click ‘Finish’.
You should now have an Excel spreadsheet with three columns – the first one telling you whether it’s a Page or a Post, the second showing the URL and the third showing the Title of the page or post.
Now save this file as an Excel file.
You’re now able to sort this file in Excel so it just shows your posts. You can then take that data and use it elsewhere.
Why Should You Bother Doing This?
As I mentioned earlier, one of the problems of a blog is that newer readers probably haven’t read all your old articles. Yet, many of those articles are probably still relevant today.
There’s a couple of ways I’ll be using this list.
- I’ll be creating a list that I’ll upload to Hootsuite so I can schedule Tweets that link to these older posts. This list will contain some text and the URL of the post.
- Using the same list, I’ll schedule some posts to Facebook, again using Hootsuite.
- I can also schedule posts to LinkedIn using the same list.
- I’ll add some new emails to my email auto-responder (with Aweber)
- I’ll go back to some articles and submit them to article directories.
- I can create YouTube videos where I talk about the article’s content.
- I’ll look over the list to get ideas for new blog articles that can build on the original article and also link back to the original.
So there are a lot of ways I can use this information to better promote my blog and services. I don’t want my older posts to be lost – I still think they can be relevant!
Get a list of your URLs now. This process took less than five minutes, and has given me some very valuable information that I can use.
Please leave a comment below so I know how you’ve gone with the instructions. Have I missed anything or glossed over anything that doesn’t make sense? Let me know.