gabesands
Member
Posted 4 years ago #
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!
gabesands
Member
Posted 4 years ago #
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
tracyselena
Member
Posted 3 years ago #
and this change is made where? in which file?
gabesands
Member
Posted 3 years ago #
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 } ?>