• How can I remove post titles from being viewed on the homepage, and on individual posts?

    I’d like to be able to title a blog post for SEO purposes, but I would not like viewers to ever see the titles while visiting my website. How can I do this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • remove the corresponding codes from your theme’s templates of the index page and single posts.

    https://make.ww.wp.xz.cn/support/handbook/forum-welcome/#include-as-much-information-as-possible

    Thread Starter jaymoney710

    (@jaymoney710)

    I’m not sure what you mean. What code should I remove? I’m using the Twenty Seventeen theme.

    two possiblities:

    – to hide the output of post titles on the home page and on posts, using CSS;

    example:

    .blog .entry-title, .single .entry-header .entry-title { display: none; }

    – to fully remove the code;
    start by creating a child theme of Twenty Seventeen;
    add the following template files from the Twenty Seventeen theme into this child theme (create the same folder structure):

    /template-parts/post/content.php
    /template-parts/post/content-audio.php
    /template-parts/post/content-gallery.php
    /template-parts/post/content-image.php
    /template-parts/post/content-video.php

    in each of the files, remove:

    			if ( is_single() ) {
    				the_title( '<h1 class="entry-title">', '</h1>' );
    			} elseif ( is_front_page() && is_home() ) {
    				the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' );
    			} else {
    				the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
    			}

    add
    /template-parts/post/content-excerpt.php
    to the child theme, and remove this code section:

    	<?php if ( is_front_page() && ! is_home() ) {
    
    			// The excerpt is being displayed within a front page section, so it's a lower hierarchy than h2.
    			the_title( sprintf( '<h3 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h3>' );
    		} else {
    			the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
    		} ?>
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Removing Post Titles from WordPress’ is closed to new replies.