My Website Doesn’t Display Correctly on WordPress
You’ve been blogging for years and are excited to finally launch your website. You spent lots of time learning how to build a web platform from the ground up. You even launched a successful Kickstarter campaign to fund your project, and now you’re ready to share your work with the world!
When you log in to your WordPress dashboard, you see a list of recent activity, including the posts you’ve published, like this:
- Blog article
- Blog article
- Blog article
Then you click on Recent Posts and get a list of your blog posts, as usual. But when you click on one of them, you see this:
- Blog article
- Blog article
- Blog article
The problem is your WordPress installation is set to display three posts per page instead of the usual 20. This means only three posts will display when you click on Recent Posts. To fix this, go to Settings → Reading and change the Number of posts per page to 3 or 20.
You’ll also want to switch to the Latest posts RSS feed if you haven’t already. This will ensure you always see the most recent posts on your homepage.
Why did my posts disappear from my home page?
WordPress keeps a copy of your posts in the cloud so it can serve them to anyone who visits your site. This is called the ‘blog archive’ and it’s where your previously published posts are stored. But when you have more than three posts, the archive can become unwieldy. To avoid this, WordPress limits the number of posts you can have posted in the past.
The reason why your posts disappeared from your home page is because WordPress is loading only the first three posts into your archive, instead of the whole lot. To see all your posts at once, you need to click on the “view all posts” link at the top of the blog archive.
Once you’ve done this, you’ll see all your posts, as expected.
If you’ve ever read a good book and wanted to revisit the experience of reading it for pleasure, but didn’t want to lose track of what you’ve already read, you can use a tool like Readability to create a digital bookmark. Readability allows you to save a page you’re currently reading and revisit it whenever you want, without having to worry about losing track of what you’ve already read.
The ‘blog archive’ seems empty!
If you’ve just launched your blog and have only a handful of posts, then it can seem like your blog archive is empty. But don’t worry, as we mentioned above, WordPress keeps a backup copy of your posts in the cloud and you can always access them from any computer.
To see your whole blog archive, simply log in to your WordPress dashboard and navigate to the “Posts” section. From here, you can click on a month to see a list of your posts published in that month. You can also click on a year to see a list of your posts published in the previous year.
You don’t have to go through all the backlog of posts to find the ones you published. If you’re looking for the most recent post, you can just click on the “Newest post” link at the top of the archive.
How do I get my posts displayed on my home page?
Now that you have a good understanding of how WordPress stores your posts and why only the first three are displayed on your homepage, it’s time to learn how to fix this. To do so, you’ll need to make a few changes to the source code of your site. We’ll go through the changes one by one so you can see what’s going on and understand how each part works together to eventually display all your posts on your homepage.
First, open up the file called “index.php” in your WordPress dashboard and find the query_posts() function.
This is the function that WordPress uses to query posts for your home page. When we say “query posts”, we mean it will search through your whole database of posts and display the first three it finds.
In the above code, you’ll see the query_posts() function nested inside the while() loop. What this means is it will always be called within the context of a loop, which means it will keep getting rerun as long as your while() loop has content. So if you want to show all your posts on your homepage, you’ll need to get rid of the while() loop.
Next, find the query_posts() function again, but this time search for the “paged” parameter. When someone clicks on a post on your site, they’ll be taken to a page that displays the post and additional information about it, such as an excerpt and a tag cloud. The “paged” parameter specifies which page of results you’d like.
In the above code, you’ll see the “paged” parameter set to 3, meaning only the first three posts will be shown on the page. You’ll need to change it to “paged” to show all the posts on the page.
After you’ve changed the paged parameter in the previous step, go back to the index.php file and look for the query_posts() function again. This time, search for the “showposts” parameter.
This one is simple, showposts sets the number of posts you’d like to see on a page. We’ve set it to 3, the same as the paged parameter.
Now if you navigate to your site and click on a post, you’ll see this:
- Blog article
- Blog article
- Blog article
Good job! You’ve successfully changed the way your posts are displayed on your site. Don’t forget to click on the “Save Changes” button at the top of the page to save your new settings.
How do I get my posts displayed on my profile page?
The profile page of a WordPress user represents their interests and hobbies, usually in the form of a blog or a social media feed. As the name would suggest, the profile page of a WordPress user displays information about that user, such as their name and email address. In some cases, it will also display photos of the user, their interests, and a handful of recent blog posts.
To get your posts displayed on your profile page, you need to follow these same steps as above. However, you’ll need to make a few adjustments to the code. Here’s what you need to do:
First, open up the file called “profile.php” in your WordPress dashboard and find the query_posts() function.
This is the function that WordPress uses to query posts for your profile page. As before, when we say “query posts”, we mean it will search through your whole database of posts and display the first three it finds.
In the above code, you’ll see the query_posts() function nested inside the while() loop. What this means is it will always be called within the context of a loop, which means it will keep getting rerun as long as your while() loop has content. So if you want to show all your posts on your profile page, you’ll need to get rid of the while() loop.