Home Forums Themes Support Claue I want to remove blog single post feature image

Viewing 1 reply thread
  • Author
    Posts
    • #29014

      I want to remove the feature image from the single post header and replace it with a background color.

       

       

      How do I do it?

    • #29020

      Hi,

      1. Please add below code to claue-child > funtions.php

      if ( ! function_exists( 'jas_claue_head_single' ) ) {
      	function jas_claue_head_single() {
      		$output = $atts = '';
      
      		// Get post or page thumbnail
      		$image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full', false );
      
      		if ( $image ) {
      			$atts = 'style="background: url(' . esc_url( $image[0] ) . ') no-repeat center center / cover;"';
      		}
      
      		// Get posted on
      		$time = '<time class="entry-date published updated f__libre"' . jas_claue_schema_metadata( array( 'context' => 'entry_time', 'echo' => false ) ) . '>%2$s</time>';
      
      		// Post categories
      		$categories = get_the_category_list( esc_html__( ', ', 'claue' ) );
      
      		$output .= '<div class="page-head pr tc" ' . $atts . '>';
      			$output .= '<div class="jas-container pr">';
      				$output .= sprintf( '<h1 class="tu cw mb__10" ' . jas_claue_schema_metadata( array( 'context' => 'entry_title', 'echo' => false ) ) . '>%s</h1>', get_the_title() );
      				$output .= sprintf( $time,
      					esc_attr( get_the_date( 'c' ) ),
      					esc_html( get_the_date() )
      				);
      				$output .= '<div class="pr mt__10">';
      					if ( $categories ) {
      						$output .= sprintf( '<span>' . esc_html__( 'In %1$s ', 'claue' ) . '</span>', $categories );
      					}
      					// Post comments
      					if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
      						$comments_number = get_comments_number();
      		    
      						if ( '1' === $comments_number ) {
      							$output .= '<span class="comment-number pr"><a href="' . get_comments_link() . '">' .sprintf( _x( '1 Comment', 'comments title', 'claue' ), get_the_title() );
      							$output .= '</a></span>';
      						} else {
      							$output .= '<span class="comment-number pr"><a href="' . get_comments_link() . '">' . sprintf(
      								_nx(
      									'%1$s Comment',
      									'%1$s Comments',
      									$comments_number,
      									'comments title',
      									'claue'
      								),
      								number_format_i18n( $comments_number ),
      								get_the_title()
      							);
      							$output .= '</a></span>';
      						}
      
      					}
      				$output .= '</div>';
      			$output .= '</div>';
      		$output .= '</div>';
      
      		return apply_filters( 'jas_claue_head_single', $output );
      	}
      }

      and change code

      $atts = 'style="background: url(' . esc_url( $image[0] ) . ') no-repeat center center / cover;"';

      to

      $atts = 'style="background: #000 "';

      and change #000 with your color hexa code

      2. And add below code to Claue > Theme Option > general layout > custom CSs

      .single-post .page-head::before {
      	background: none;
      }

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

Viewing 1 reply thread

You must be logged in to reply to this topic.