• Resolved gabesands

    (@gabesands)


    Hi,

    I wish to remove the page title in the home page only and keep it in every other page. Basically, the opposite of the code bellow.

    <?php if (!is_page(‘home’)) { ?><h2><?php the_title(); ?></h2><?php } ?>

    I’ve tried searching for it and tried to code it, but anything I tried didn’t work.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter gabesands

    (@gabesands)

    I figured it out!

    <?php if ( is_front_page() ) { ?><?php } else { ?><h2><?php the_title(); ?></h2><?php } ?>

    English:
    If it’s the frontpage then show nothing, or else show the title

    and this change is made where? in which file?

    Thread Starter gabesands

    (@gabesands)

    you change it in the index.php file or page.php file (if you have a main page), just make sure that you edit the correct line (the one within the body).

    Search for
    <?php the_title(); ?>
    and add
    <?php if ( is_front_page() ) { ?><?php } else { ?>
    in front and
    <?php } ?>
    behind it.

    The optional H2 tag is used to make it a secondary heading.

    How can i do that here.

    This is the page code

    <?php if (have_posts()) : the_post(); update_post_caches($posts); ?>

    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <h2><?php the_title(); ?></h2>

    <div class=”content”>
    <?php the_content(); ?>
    <div class=”fixed”></div>
    </div>
    </div>

    <?php else : ?>
    <div class=”errorbox”>
    <?php _e(‘Sorry, no posts matched your criteria.’, ‘inove’); ?>
    </div>
    <?php endif; ?>

    <?php include(‘comments.php’); ?>

    Like this for example; resolved

    <?php if ( is_page(GUITAR) ) { ?><?php } else { ?>

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

    <?php } ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘need to hide the home page title only’ is closed to new replies.