I want to remove the h1 tag for the particular page because my page.php file coded is displaying the title for all the pages but want to remove h1 tag(title) for particular page.
code for displaying the titles for all the page:
<?php
/**
* The template for displaying all pages.
*/
get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?>
<section id="subbanner">
<?php the_post_thumbnail(); ?>
</section>
<section id="subcontent">
<section id="service">
<aside class="frame">
<h1><?php the_title();?></h1>
<?php the_content();?>
</aside>
</section>
<?php endwhile;?>
<?php get_footer(); ?>
so i customized to my requirement for removing the h1 tag for particular page using if else statement by finding the page_id of the particular page but this doesn’t work properly.
<?php function remove_heading_for_particular_page() {
if ( is_page('page_id=1757') ) {?>
<?php the_content();?>
<?php }else{?>
<h1><?php the_title();?></h1>
<?php the_content();?>
<?php }?>
<?php }?>
could anyone help me to find solution for removing the h1 tag for particular page.
Thanks in advance.
You are not using
is_page()
properly. You have to use it likeis_page( 1757 )
instead ofis_page('page_id=1757')
.So your
if
condition will be as like :Hope it helps you.
is_page() function takes page id directly instead of string.
Hope this code will help you 🙂