Saturday, December 24, 2016

How to Make a Web Page Your Homepage

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

  1. After logging into the WordPress Dashboard, click Pages, then click the Add New button.
  2. Create your page, and then click Publish.
  3. Hover over Settings in the WordPress Menu, and then click Reading.
  4. In the Front Page Displays section at the top, change from Your Latest Posts to A Static Page.
  5. Select your newly created page from the Front Page list.
  6. Scroll down and click the Save Changes button.
  7. 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.
  8. 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.
  9. Under the Plugins Menu, click Create a New Plugin.
  10. Call it something like: Hide the Home Page Title Plugin, then click the Create a Blank Plugin button.
  11. 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.
  12. After pasting in your function, click the Update File button.
  13. 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');


How to Make a Web Page Your Homepage shared from Tipsandtricks-HQ


How to Make a Web Page Your Homepage syndicated from Aileen Batts Blog




from Leslies Tumblr http://lesliesrubin.tumblr.com/post/154924844057

No comments:

Post a Comment