This article explains how to automatically display a list of all WordPress posts on a single page. You only need to add a single source file and you are ready to go.
Automatically display all posts in WordPress
There are some situations where you want to have an overview of all posts you ever made in your WordPress blog. May it be issues of tightening your internal link profile or some methodic approach to social media marketing and content spreading. It may even be the case that you want to give a list of all posts to your valued readers whatever reason for.
Of course I do not suggest you to manually compile these posts from time to time. There is an automatic and really neat way to get to the goal. And it works with the newest WordPress version. Take the following source code and put it into a file named page-allposts.php. Then upload the file to your WordPress webspace and there into the directory of your active theme. If you use Twentythirteen as I do, then copy the file to the folder /wp-content/themes/twentythirteen/ under your WordPress root directory. Here is the code:
This code is taken from the great article How to display all posts in a single page using WordPress and then adapted by me (I could not paste it in as WordPress and the Scripts used destroyed it on display). It may be necessary to do some slight adjustments regarding the layout in case you use a different theme. For that, take the existing file page.php as inspiration (same directory as above mentioned)…
After having the code in place, create a new page (not a post!) and choose All Posts as a template:
Also you can have a page title in place as with any other ordinary page. The text from the main content you type will be shown above the automatically generated list of all WordPress posts. On ERFOLGSREZEPTE ONLINE the final result looks like this:
You may also like to see a live view of the generated page (it seems as it only shows up if you are logged in as admin, I am still figuring out why).
As SEO expert I would like to give you one tip for the all posts page: Set the page to nofollow as this would not make any sense, except wasting the crawl budget for your site.
PS: In case you make some enhancements to the code I would love to hear from you!
How did you like this post?
Letzte Artikel von Dr. Klaus Meffert (Alle anzeigen)
- Online-Shop selber betreiben: So geht’s - 4. März 2018
- Datenschutz für Webseiten wirtschaftlich umsetzen - 15. Dezember 2017
- Siebtlingsgeburt im SEO Content 2017 – Erfolgsrezepte Online - 1. Oktober 2017