Harshita Harshita - 5 months ago 18
PHP Question

Wordpress : want to display content title on the top of all pages except on front page/home page

Right now i am here,
enter image description here
As you see in this snap title contact us, i want to fix this title as itis in same position, but i am trying to display this on all page of my site except home page.

code is here :

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


i have tried like this to display :

<header class="entry-header">
<?php
if ( function_exists( 'cg-page-title' ) && (!is_front_page() ) ) {
cg-page-title( '<h1 class="cg-page-title"> the_title();','</h1>' );
}
?>
</header>


But, it doesn't work.

Answer

Maybe try :

<header class="entry-header">
    <?php if( !is_home() && !is_front_page() ): ?>
        <h1 class="cg-page-title"><?php the_title(); ?></h1>
    <?php endif; ?>
</header>
Comments