H1 - Title of each page: How to remove the H1-Tag from the source code?

Hey there!

When creating a new page, you have the following option:
Check this box to hide the title

This option, does NOT remove the title in the source code.
All it does. it’s hiding the H1-Title from the display!

Where and how to remove this option entirely from the SOURCE CODE???

Hello there,

It is always recommended editing the code in the child theme mode instead of touching the main theme’s source code. So the changes will remain when the theme gets updated. Here are the steps you should follow:

  1. Copy the content-page.php and content-single.php files from main theme’s folder, and then paste into child theme’s.
  2. Open those two files on your preferred code editor application.
  3. In content-page.php file, replace the below code block:

<header class="entry-header">
	<?php the_title( '<h1 class="title-post entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->

with:


	<?php
	$hide_title = get_post_meta( get_the_ID(), 'wpcf-single-hide-title', true );
	if( !$hide_title ) {
	?>

	<header class="entry-header">
		<?php the_title( '<h1 class="title-post entry-title">', '</h1>' ); ?>
	</header><!-- .entry-header -->

	<?php } ?>

  1. In content-single.php file, replace this code block:

<header class="entry-header">
	<?php the_title( '<h1 class="title-post entry-title">', '</h1>' ); ?>

	<?php if (get_theme_mod('hide_meta_single') != 1 ) : ?>
	<div class="meta-post">
		<?php sydney_posted_on(); ?>
	</div><!-- .entry-meta -->
	<?php endif; ?>
</header><!-- .entry-header -->

with:


	<?php
	$hide_title = get_post_meta( get_the_ID(), 'wpcf-single-hide-title', true );
	if( !$hide_title ) {
	?>

	<header class="entry-header">
		<?php the_title( '<h1 class="title-post entry-title">', '</h1>' ); ?>

		<?php if (get_theme_mod('hide_meta_single') != 1 ) : ?>
		<div class="meta-post">
			<?php sydney_posted_on(); ?>
		</div><!-- .entry-meta -->
		<?php endif; ?>
	</header><!-- .entry-header -->

	<?php } ?>

  1. Update the two updated files through either FTP or cPanel’s file manager.

Regards,
Kharis