• Resolved baytonorg

    (@baytonorg)


    Good Day,

    I’ve searched this for a while, and come up short.
    I’ve seen plenty of how-tos which go into a lot of detail, but are described in a way that is too technical for me to understand.

    I want to remove “welcome” on my homepage https://www.bayton.org

    I’ve tried creating a new page template as described here:
    https://www.wordpressmax.com/customize-wordpress/custom-page

    I’ve tried removing the
    <h2><a href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>”><?php the_title(); ?></a></h2>

    but both of these just mess up the layout of my page.

    I’ve also tried #header h1 { display:none } in the css which started altering my banner

    And #post-1 h2 {display:none } which removed the title of my blog posts, not my pages!

    Any help appreciated, as I’m doing more harm than good on my own.
    Also, those who are kind enough to help, explain it to me as if you were talking to a 3 year old. I’m very, very new to WP

    Jason

Viewing 15 replies - 1 through 15 (of 21 total)
  • look in theme’s index.php or home.php

    Thread Starter baytonorg

    (@baytonorg)

    I’m sorry samboll, but that doesn’t help me in the slightest.

    <?php if (is_front_page()) {echo '<h2>&nbsp;</h2>';} else {
    echo '<h2>'.the_title().'</h2>'; }
    ?>

    should do it for you. HTH

    Thread Starter baytonorg

    (@baytonorg)

    Thankyou syncbox, where do I place this code?

    Oops! Got the whole thing deleted.

    You may replace the follwoing line from the “page.php” with what syncbox has suggested:

    <h2><?php the_title(); ?></h2>

    I assume that you use static front page.

    S.K

    Ok. If you had created a custom page template and had assigned to your “Home” page, then edit that template the same way.

    S.K

    Look in your template files to find where the_title() is called (in the loop)

    in the default theme, it looks like this:

    <?php if (have_posts()) : ?>
    
    <?php while (have_posts()) : the_post(); ?>
    
    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    <strong>
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
    <?php the_title(); ?></a></h2></strong>
    
    <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
    
    <div class="entry">
    <?php the_content('Read the rest of this entry &raquo;'); ?>
    </div>
    
    <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    </div>
    
    <?php endwhile; ?>
    
    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    </div>
    
    <?php else : ?>
    
    <h2 class="center">Not Found</h2>
    <p class="center">Sorry, but you are looking for something that isn't here.</p>
    <?php get_search_form(); ?>
    
    <?php endif; ?>

    replace that bolded bit with:

    <?php if (is_front_page()) {
    echo
    '<h2>&nbsp;</h2>'; //write the tags, but show nothing
    } else {
    echo
    '<h2><a href="'.the_permalink().'" rel="bookmark" title="Permanent Link to'.the_title_attribute().'">'.the_title().'</a></h2>';//write the standard loop markup
    }
    ?>

    I’m not sure how much you know about php and WordPress… what I am doing up there when writing the title only if NOT the front page (homepage) is using echo to write tags and static info… the stuff between the periods are functions (not literal information). That may be more than you want or need to know…

    Anyway, whichever template file is used to display your content (page.php for Pages; index.php or category.php for Posts, etc is where you look for the LOOP and modify things. For instance, I use page.php a LOT… and typically for the frontpage. Some sites never use pages and so the loop modification would be in the index.php file.

    HTH

    Thread Starter baytonorg

    (@baytonorg)

    Hi syncbox

    If you now look at the site, you’ll see that the main page has gone to the dogs. I don’t know why it has done this as I did exactly as you told me.

    First I replaced it in the “default” location – no change.
    Then in the “blueberry” location (current theme)

    I did it to page.php, as I use a static page.

    https://www.bayton.org

    Do you know why it does this?

    Can you copy and paste the contents of the page template as it is now, in https://wordpress.pastebin.com/ and post the link here. Let me have a look.

    S.K

    Thread Starter baytonorg

    (@baytonorg)

    Here you are kichu

    https://wordpress.pastebin.com/m36ff3da0

    Thanks in advance.

    It’s even easier if you install the All in one SEO Pack plugin, where you can specify the title of your homepage, and customize titles for second-level pages.

    @ Bayton.org

    I have modified it and tested it. It is working. Actually a div element was missing. Plus I’ve simplified the PHP code to avoid printing of the title on the front page.

    You can view it here:

    https://wordpress.pastebin.com/d214b9c10

    and download it from here for copy-paste:

    https://wordpress.pastebin.com/pastebin.php?dl=d214b9c10

    Give a holler if stuck.

    S.K

    Thread Starter baytonorg

    (@baytonorg)

    Kichu!

    You sir, are a scholar and a gent!

    I can’t thank you enough, it looks perfect!

    Jason

    Thread Starter baytonorg

    (@baytonorg)

    I’m sorry,

    Now I’ve noticed another issue..

    The titles on all other *pages* are small, and almost unnoticeable.
    Also, the sidebar is no longer available when I view an individual post (not page!).

    I don’t suppose you’d be so kind? ??

    Here’s the code for index.php (for posts!)
    https://wordpress.pastebin.com/m53e6be6e

    Thanks again!

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Hiding the title on my homepage only’ is closed to new replies.