In this WordPress quick tip you’ll learn how to edit the home page in WordPress. This is a really important part of any website and WordPress helps you deal with it in several ways. Let’s dive in!
How to Edit the Homepage in WordPress
Premium WordPress Themes and Plugins
Before we start: when setting up your WordPress website you’ll want to explore the thousands of WordPress themes on ThemeForest and WordPress plugins on CodeCanyon. Purchase these high-quality WordPress themes and plugins and improve your website experience for you and your visitors.
How to Edit the WordPress Homepage
Begin By Setting up a Homepage in WordPress
To edit your WordPress website’s homepage you first need to actually define which of your pages is the homepage. To do this, go to your WordPress admin > Settings > Reading and then define what your homepage displays:
Here you can state that your WordPress homepage should display your latest posts, or you can define a specific page to use as your homepage.
Display Latest Posts
If you select Your latest posts, your homepage will use the index.php from within your template files, and the output will show an archive of blog posts like this:
Editing the blog posts will change what’s actually output to the page, but to change the homepage template itself we need to edit a file.
Go to admin > Appearance > ThemeEditor and in the sidebar you can find the file you want to edit (highlighted in this case by the fact that it’s the Main Index Template):
If you select the file it will be opened up in the editor window. What you see is all the PHP and HTML responsible for outputting the posts on what’s currently your homepage.
To edit this file, make your changes in the editor window and click Update File. But be warned! I don’t recommend making changes directly to these files if you have no experience working with PHP. This filed editor does run a code check before saving your changes, but you’re editing the live website and could make some problematic changes!
A safer way to make changes like this is to open the file in a code editor, on your local computer system, and upload the changed file to the web server via FTP. The index.php file we’re editing here can be found in your WordPress installation > wp_content > themes > your_theme > index.php.
To learn more about how this works, I go into more detail in this tutorial:
Display a Static Page
Going back to our original settings, we might also have stated that our homepage should be a static page. In this case we select, from the dropdown, the page we want to act as our WordPress homepage.
Editing the content of the page is as easy as going to Pages > your_page and changing the content.
You can also change the template your homepage page is using. Go to Page Attributes > Template and select one of the templates in the dropdown list.
Depending on the templates the theme author has created, this will enable you to display the homepage in different ways.
The default template you see here will appear as standard, and the file to edit (like we did earlier) will be the singular.php in your theme’s root folder.
That’s How to Change the Homepage in WordPress
So that wraps things up for this quick tip! To change the homepage in WordPress:
- First make sure you know whether you’re displaying blog posts or a static page by going to Settings > Reading.
- If you’re displaying blog posts you can most likely edit the index.php file. Check this is the case by going to Appearance > ThemeEditor and seeing which file is assigned as the homepage.
- If you’re using a static page as the homepage you can edit the contents directly in the page editor.
- Edit the singular.php file if you want to change the code in the default page template.
- You can also select which page template is used by going to the Page Attributes section in the sidebar of the page editor.
Stay tuned for more WordPress quick tips!
No comments:
Post a Comment