WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Hiding the front page title on a static page (12 posts)

  1. bargeloobs
    Member
    Posted 3 years ago #

    I know this question has been asked before because frankly I think I've read a hundred different answers, but I'm having trouble finding a solution specific to my theme and it's actually getting to the point of driving me nuts.
    What I need to do is remove or hide the "Home" title from showing up on my static front page whilst keeping it within the main navigation.
    I have recently switched from the Weaver theme to Wallow and this is where the problem stemed from. My knowledge of coding is limited at best so could you please go easy. After scouring my style.css, index.php, header.php I can't really find anything close to what people have been suggesting but I'm just wondering if there might be a change made within the page.php that could help. This snippet here looks like something I might need to alter.... I hope.

    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    <?php the_post_thumbnail( array( 150,150 ), array( 'class' => 'alignleft' ) ); ?>
    <h3 class="s">" rel="bookmark">
    <?php
    $post_title = the_title_attribute('echo=0');
    if (!$post_title) { _e( '', 'home' ); } else { echo $post_title; } ;
    ?>

    Any suggestions would really be appreciated, It's probably a 1 minute job for someone who knows what they're doing but I'm all out of things to try! Thanks in advance and hopefully someone can rid me of this pesky title. Cheers!

  2. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Actually, you're looking in the wrong template file.

    If you're using a static Page as your Front Page, then WordPress will look for the following template files, in order:

    1) front-page.php
    2) page.php
    3) index.php

    Your Theme doesn't have a front-page.php template file, so you need to look in page.php.

    Here's the section you need:

    <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark">
    	<?php
    	$post_title = the_title_attribute('echo=0');
    	if (!$post_title) { _e( '(no title)', 'wallow' ); } else { echo $post_title; } ;
    	?>
    </a>
    </h3>

    Wrap all of the above code in an is_front_page() conditional, e.g.:

    if ( ! is_front_page() ) {
    	?>
    	<h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark">
    	<?php
    	$post_title = the_title_attribute('echo=0');
    	if (!$post_title) { _e( '(no title)', 'wallow' ); } else { echo $post_title; } ;
    	?>
    	</a>
    	</h3>
    	<?php
    }
  3. bargeloobs
    Member
    Posted 3 years ago #

    Hi, thanks for your suggestions, sorry that code in the page.php Iv'e listed is the same as yours, I had changed a couple of things whilst experimenting and forgot to change them back.
    I've entered the conditional as you've stated but end up with
    if ( ! is_front_page() ) { ?>
    actually displaying on the homepage href="http://www.easydietsreviewed.com/">
    What am I doing wrong?

  4. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    I've entered the conditional as you've stated but end up with
    if ( ! is_front_page() ) { ?>
    actually displaying on the homepage

    That's PHP code; it needs to be wrapped in PHP tags:

    <?php
    // PHP code goes here
    ?>
  5. bargeloobs
    Member
    Posted 3 years ago #

    This is what I've done
    `<?php
    //

    if ( ! is_front_page() ) {
    ?>
    <h3 class="storytitle">" rel="bookmark">
    <?php
    $post_title = the_title_attribute('echo=0');
    if (!$post_title) { _e( '(no title)', 'wallow' ); } else { echo $post_title; } ;
    ?>

    </h3>

    And it returns a syntax error. Sorry Chip you'll have to bear with me.

  6. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Can you please wrap your code in backticks?

  7. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    What is the exact syntax error that you get? It looks like you're missing the closing brace for the if ( ! is_front_page() ) conditional.

  8. bargeloobs
    Member
    Posted 3 years ago #

    The error is..
    Parse error: syntax error, unexpected T_ENDWHILE in /hermes/web01/b2576/moo.ultradociouscom1/easydietsreviewed/easydietsreviewed.com/wp-content/themes/wallow/page.php on line 65

  9. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Yep: ou're missing the closing brace for the if ( ! is_front_page() ) conditional:

    <?php
    if ( ! is_front_page() ) {
         // code goes here
    } // <---- this is the closing brace that you're missing
    ?>
  10. bargeloobs
    Member
    Posted 3 years ago #

    SUCCESS!!! Thanks Chip you're a legend!
    You don't know how grateful I am. Cheers!

  11. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Glad to help. :)

    p.s. be sure to mark the topic as "Resolved", so facilitate others with a similar problem finding an answer.

  12. bargeloobs
    Member
    Posted 3 years ago #

    No Worries, Thanks again, keep up the good work :-)

Topic Closed

This topic has been closed to new replies.

About this Topic