I want to hide the featured image in the post page, but not on the home page.
I had a look at the other posts about this same problem, but they didn’t work for me, so I will appreciate your help.
Here is my single.php
<div id="primary" class="full-width-page">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'single' ); ?>
<?php tesseract_post_nav(); ?>
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
<?php endwhile; // end of the loop. ?>
</main><!-- #main -->
</div><!-- #primary -->
Add this to your functions.php (prefer child-theme), and that is it. It works on any theme, and you don’t need to touch the ugly HTML templates.
References:
https://helloacm.com/how-to-hide-feature-image-of-posts-in-wordpress/
Please, write what theme you are using.
According to what you wrote you have to edit content-single.php.
Search for the line like this:
or
And remove or comment it.
The code is in the template part. You will find the feature image function in the file named ‘content-single’.
There are two ways to disable:
1. Find the code.
Remove or comment the function in your
content-single
template file:2. CSS method.
Find the appropriate class of the image div and add a display none condition in your style sheet.
If you can share the site url I can answer more clearly.
How to remove featured image background from Tesseract Theme single posts:
1.- First of all make a copy from the original content-single.php file.
2.- Edit content-single.php with a plain text editor.
3.- If the original file is like this:
( Source: github.com/Conutant/TESSERACT/blob/Master_Branch/content-single.php )
4.- To remove the featured image background, change it to this:
5.- Remember that all changes will be overwritten when you update the theme to a new version. A good option to avoid this is to create a Child Theme, the recommended way of modifying an existing theme. More information can be found at: https://codex.wordpress.org/Child_Themes
6.- Test it and let me know if you have any problem.
Regards.
In your code there is one line
which means it calls content.php file of your current theme. go to that file and comment following code
But note that it removes thumbnail everywhere when content.php file calls, so better idea is create custom single.php file. For that you need to copy in single.php file and rename with your post name.
for example if you use post for add your content then rename with single-post.php or if you use custom post type like news then rename with single-news.php.
After that open this file and remove this code
from file and goto the content.php file and copy your require code which you want to display and paste in your new file.