This is a tutorial for the video answers to top WordPress questions series that we have been publishing on this site to help users get started with WordPress.
In this tutorial, you will learn:
- How to use a WordPress Page as your homepage, rather than the default list of posts.
- How to remove the title for the newly created static homepage, by creating a small plugin.
Steps to Switch to a Static Homepage and to Remove the Title
- After logging into the WordPress Dashboard, click Pages, then click the Add New button.
- Create your page, and then click Publish.
- Hover over Settings in the WordPress Menu, and then click Reading.
- In the Front Page Displays section at the top, change from Your Latest Posts to A Static Page.
- Select your newly created page from the Front Page list.
- Scroll down and click the Save Changes button.
- By default, the title of the static homepage will show up on the web site. While having the title is handy for referencing the page from within the WordPress Dashboard, its display may not be desired on the web site. Let’s create a small plugin to hide it.
- Install the Pluginception plugin to make plugin creation simpler, by going to Plugins, then Add New. Then do a search for Pluginception, click Install Now, then click Activate.
- Under the Plugins Menu, click Create a New Plugin.
- Call it something like: Hide the Home Page Title Plugin, then click the Create a Blank Plugin button.
- Now, you can add a function that filters the title, but just for the home page. You can see the code on the video screen, or it can be copied from the web page that this written tutorial is on. Essentially, you are using a WordPress filter hook on the_title function. You also want to make certain that you are only hiding the title on the home page of the web site and not in menus, and not within the Admin area. You also want to make certain that you are not affecting other pages, so you want to run the is_front_page conditional check within your code.
- After pasting in your function, click the Update File button.
- Then, view your homepage to see if the title has been filtered away. Then check other pages and the navigation menu, as well as the Pages area in the Dashboard to make sure the home page title remains in those places.
Code used within this tutorial:
function remove_home_page_title( $title ) { if( is_admin() || !in_the_loop() ) { return $title; } if ( is_front_page() ) { return ''; } else { return $title; } } add_filter('the_title', 'remove_home_page_title');
Leave a Reply