H
H
Heronix2015-10-08 12:53:02
WordPress
Heronix, 2015-10-08 12:53:02

Wordpress remove thumbnail?

33c0729cf87940da9bb098654d721471.PNG
Tell me how to remove this thumbnail on the left? When adding news, I did not select a thumbnail, it is included in the template by default

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Ivanq, 2015-10-08
@Ivanq

It comes out only by editing the template. Otherwise, the template will fail.

D
Danila, 2015-10-08
@lega111

You can do so.
Option 1 - in general, whatever they are, they will be deleted. You need to edit the functions.php file in your theme folder. P.s. be careful here, you can cheat the template by editing this file, make backups.

global $wpdb;

$attachments = $wpdb->get_results( "
     SELECT * 
     FROM $wpdb->postmeta 
     WHERE meta_key = '_thumbnail_id'
" );

foreach ( $attachments as $attachment ) {
    wp_delete_attachment( $attachment->meta_value, true );
}

$wpdb->query( "
    DELETE FROM $wpdb->postmeta 
    WHERE meta_key = '_thumbnail_id'
" );

Option 2:
Remove <?php the_post_thumbnail(); ?> in the single.php file Option
3 (never did this, always rules functions.php) - in the place where thumbnails are displayed, write the condition if ( has_post_thumbnail() and is_front_page() or is_category() )

D
Dmitry, 2015-10-11
@dimasmagadan

try adding the following to functions.php

function my_post_image_html( $html, $post_id, $post_image_id ) {
  if(is_singular() ){
    $html = '';
  }
  return $html;
}
add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );

this will disable the display of thumbnails on pages and individual posts

S
sivabur, 2015-10-31
@sivabur

so in the settings of the post itself) as far as I remember, you can turn off the thumbnail))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question