最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to display featured image without it appearing in post?

programmeradmin1浏览0评论

I want to have the featured image as a thumbnail when I search for the post but I don't want the featured image to be on the actual post itself. Are there any plugins or edits to code that I can do?

I want to have the featured image as a thumbnail when I search for the post but I don't want the featured image to be on the actual post itself. Are there any plugins or edits to code that I can do?

Share Improve this question asked Sep 23, 2014 at 16:27 JamesJames 111 bronze badge 1
  • 1 Please edit and elaborate your question with more details, as from now on it's not clear how you want to do that. Possibilities can be: (1) Assigned a FImg, but don't display the image in single post, only on search results, (2) Assigned an FImg for search results and a different image for single post page, and show them accordingly... Please explain more. – Mayeenul Islam Commented Sep 23, 2014 at 16:59
Add a comment  | 

2 Answers 2

Reset to default 1

You can set the featured image on the post. That featured image will not be on the post content.

If it's showing on the post it's because your template is calling has_thumbnail() on the single.php or content-single.php.

If you need more help, please past the single.php or content-single.php code, or say which theme you are using.

Cheers, Diogo

You could use get_the_post_thumbnail or get_the_post_thumbnail_url to retrieve the featured-image/attatchment for the post.

As mentioned in this answer, look to your theme's single.php (or single-{post_type}.php) file and see if the post thumbnail is being output anywhere.

And also check other places where data from the posts you're wanting hide the thumbnails of might be output. The attachment image could be called from anywhere in the theme.

... it should be fairly straight-forward to find and remove any places the attatchment-images / post-thumbnails are being output on the website's frontend. - but ensuring that files are completely unaccessible unless logged in would be a different question.

发布评论

评论列表(0)

  1. 暂无评论