How to remove post title in post section

Hi

Child theme pro version 2.5.5,

I use custom header hero (for post type only) with title and meta inside it so I have to remove the default title in every post. How can I achieve this? for SEO reson I don’t want to hide the default title with CSS (duplicate h1)

Any workaround for this?

Thanks

Hi TheGrey,

Since you’re using the custom post type. May I know your website URL so we can take a closer look?

We can achieve that by edit the template files using the child theme:

Thanks.

Hi Thai

Yes you can, here is the example post

as you can see i need to get rid the default title below the hero

Hey @valkyrieads,

To do that you will have to override the single post template through the child theme. Please install and activate the child theme. If you do not have the child theme installed yet, you can download it from here. Once you have it installed and activated, please login through FTP then go to wp-content/themes/pro-child then open the framework directory and create the following file path views/icon. Once you are inside the icon folder, create the file _content-post-header.php then add this code to the file:

<?php

// =============================================================================
// VIEWS/ICON/_CONTENT-POST-HEADER.PHP
// -----------------------------------------------------------------------------
// Standard <header> output for various posts.
// =============================================================================

?>

<header class="entry-header">
    <?php if ( !is_single() ) : ?>
    <h2 class="entry-title">
      <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?></a>
    </h2>
  <?php endif; ?>
  <?php x_icon_entry_meta(); ?>
  <?php if ( get_post_format() == 'quote' ) : ?>
    <p class="entry-title-sub"><?php echo get_post_meta( get_the_ID(), '_x_quote_quote', true ); ?></p>
  <?php endif; ?>
</header>

Hope this helps.

1 Like

@Jade works like a charm, by the way whichfile code i should use/copy from the origin pro theme to child theme if I want to customize (remove, add some html etc) the featured image, is it content-image.php or else?

Thank you

Hi @valkyrieads,

The featured images have a separated function which you can paste it to the functions.php file locates in your child theme and edit it:

function x_featured_image( $cropped = '' ) {

    $stack     = x_get_stack();
    $fullwidth = ( in_array( 'x-full-width-active', get_body_class() ) ) ? true : false;

    if ( has_post_thumbnail() ) {

      if ( $cropped == 'cropped' ) {
        if ( $fullwidth ) {
          $thumb = get_the_post_thumbnail( NULL, 'entry-cropped-fullwidth', NULL );
        } else {
          $thumb = get_the_post_thumbnail( NULL, 'entry-cropped', NULL );
        }
      } else {
        if ( $fullwidth ) {
          $thumb = get_the_post_thumbnail( NULL, 'entry-fullwidth', NULL );
        } else {
          $thumb = get_the_post_thumbnail( NULL, 'entry', NULL );
        }
      }

      switch ( is_singular() ) {
        case true:
          printf( '<div class="entry-thumb">%s</div>', $thumb );
          break;
        case false:
          printf( '<a href="%1$s" class="entry-thumb" title="%2$s">%3$s</a>',
            esc_url( get_permalink() ),
            esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ),
            $thumb
          );
          break;
      }

    }

}

Hope it helps :slight_smile:

1 Like

@thai noted and thanks :slight_smile: case closed

You’re welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.