WordPress.org

Forums

[resolved] I don't want homepage displaying 'Home' (13 posts)

  1. johnhooper
    Member
    Posted 1 year ago #

    Hello,

    Is there any way that I can get rid of the word Home on my static homepage?

    dartmoorlogs.com

    theme: forestly

    I have looked at the page.php file but there is nothing there that I can change.

    Any advice most welcome.

  2. LittleBigThings
    Member
    Posted 1 year ago #

    Make a child theme if you don't have one already.

    You can use CSS (style.css) to specifically remove (= not display) the page title on the homepage.

    .home #content .entry-title {
    display: none;
    }
  3. mlddev
    Member
    Posted 1 year ago #

    Another method which has been covered in past topics...

    You can edit one of your template files (such as header.php or content.php or page.php). Which file depends on where your theme calls the title with the code <?php the_title(); ?>. Once you locate which of your template files contains the code to call the title then...

    You want to wrap that code with something like the code below depending on how your home page is set:

    If your home page is set to show your latest posts:

    <?php if (is_home()) { ?>
    	<!-- don't display title (leave this blank) -->
    <?php } else { ?>
    	<h2><?php the_title(); ?></h2>
    <?php } ?>

    If your home page is set to show a static page:

    <?php if ( !is_front_page() ) :?>
    	<!-- don't display title (leave this blank) -->
    <?php } else { ?>
    	<h2><?php the_title(); ?></h2>
    <?php } ?>

    What your doing is wrapping the <?php the_title(); ?> with a conditional tag that tells WordPress to display the title on any page that is not the front page (static) or homepage (blogroll)

  4. johnhooper
    Member
    Posted 1 year ago #

    Hi, thanks for both your answers and sorry for being a bit slow to understand this.

    I tried to as you suggested mlddev but it didn't seem to work. My coding now looks like this:

    Did I do something wrong? Home is still being displayed on the static homepage.
    [Corrupted code redacted - Please repost that and wrap your code with the backtick characters]

  5. ngadow
    Member
    Posted 1 year ago #

    I was able to change that text on my home page by cicking on Apperance and then Menu - and selecting the home tab and changing the "Naviataion Label" and "Title Attribute".

  6. johnhooper
    Member
    Posted 1 year ago #

    It won't let me repost the coding but I basically replaced

    <h1 class="page-title"><?php the_title(); ?></h1>

    with what you posted above.

    Maybe I should give the child theme a go but I still wouldn't know what I have to edit to get rid of Home.

  7. LittleBigThings
    Member
    Posted 1 year ago #

    Why don't you try the CSS method? It seems for me the easiest, definitely if you have a child theme and don't want to change a template file.

    Otherwise I think that of the suggestions of mlddev the is_home conditional should work. You should put it in your front-page.php or home.php template or if you don't have any (there are no such page templates in the forestly theme by default), then in your page.php template.

    I definitely recommend using a child theme: if you don't, all these changes will be lost when updating your theme!

  8. LittleBigThings
    Member
    Posted 1 year ago #

    It is easy to set up a https://codex.wordpress.org/Child_Themes.
    you can read all about it via the above link. You just have to set up a new folder in your theme directory with the name of your child theme. Create a style.css file and insert the information as explained on the child theme codex page and the @import with the CSS of your parent theme (forestly).

    Then below that you can add the code I posted above.
    Or you can copy the appropriate template file front-page.php, home.php or page.php and modify according to mlddev's advice.

    The files in your child theme's directory won't be overwritten when your parent theme is updated. So you won't lose any modification.

  9. johnhooper
    Member
    Posted 1 year ago #

    Hi, thank you for your help so far.

    I followed the instructions as per the link, created a child folder, created a style.css file (this contained the text it says on the link that has to be included in the grey box, I also copied the entire style.css file from my current theme and then added the text you provided me with at the very end). When I do this though the website looks nothing like it currently does.

    When I try to use mlddev advice, ie paste the text he provided me with at the very end of the page.php template file nothing changes.

    What am I doing wrong?

    @ngadow I tried what you said but I still can't get rid of the word Home

  10. mlddev
    Member
    Posted 1 year ago #

    johnhooper,

    While a child theme setup is definitely the way to go, not all themes support it. I am unfamiliar with your theme and therefor don't know exactly where to point you, but...

    What I would recommend first is to locate your content-page.php file in your main theme directory. Find the code you mentioned above:

    <h1 class="entry-title"><?php the_title(); ?></h1>

    Replace that with:

    <?php if( is_home() || is_front_page() ) : ?>
    <!-- no header code -->
    <?php else : ?>
    		<h1 class="entry-title"><?php the_title(); ?></h1>
    <?php endif; ?>

    Save and upload the content-page.php file and refresh your home page.

    I downloaded your theme template files from the author and tested this so I know it will work if followed correctly.

    Let me know how it works out.

  11. LittleBigThings
    Member
    Posted 1 year ago #

    To set up a child theme you don't have to copy your theme's style.css, you can import it in you child theme's style.css. This way it will be updated when the parent theme is updated. Use this as a header for your child theme's style.css:

    /*
     Theme Name:   Forestly Child
     Theme URI:    http://wordpress.org/themes/forestly
     Description:  Forestly Child Theme
     Author:       your name
     Author URI:   your website
     Template:     forestly
     Version:      1.0.0
     Text Domain:  forestly-child
    */
    
    @import url("../forestly/style.css");

    Be sure to call your theme's folder 'forestly-child' (or something else but then you have to replace forestly-child in the above code by that).

    Further you can follow mlddev's advice, but I would suggest as I did above to copy content-page.php (indeed not page.php) to your child theme and make the suggested changes there. That way you won't lose any changes when you update the forestly theme.

  12. mlddev
    Member
    Posted 1 year ago #

    Good advise from LittleBigThing :)

  13. johnhooper
    Member
    Posted 1 year ago #

    Woohoo! Thank you mlddev, I followed your instructions and was able to solve the problem. I must admit that I didn't create a child theme, LittleBigThing as I don't plan on making many more changes like this. If I do I promise to do it :)

    Thank you all for your help and patience, great to know people like you are out there helping people like me :)

Topic Closed

This topic has been closed to new replies.

About this Topic