arthurdent2003
Member
Posted 9 months ago #
Hi!
I want to hide a thumbnail in a post - but only in the single view (the post thumbnail should show up everywhere else).
I tried it with a custom field called hidethumb, so when it is activated it should just show nothing but doesn't work:
<?php
$hidethumb = get_post_meta($post->ID, "hidethumb", true);
if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) {
the_post_thumbnail(array(150,150), array("class" => "alignleft post_thumbnail"));
else if ($hidethumb) {
echo "";}
?>
any suggestion?
Thank you!!
AD
you are testing for your custom field after the post thumbnail is shown, and only if there is no post thumb.
try:
<?php
$hidethumb = get_post_meta($post->ID, "hidethumb", true);
if ( !$hidethumb && function_exists('has_post_thumbnail') && has_post_thumbnail() ) {
the_post_thumbnail(array(150,150), array("class" => "alignleft post_thumbnail"));
?>
arthurdent2003
Member
Posted 9 months ago #
Hi alchymyth,
thank you for the reply! Works!
AD
Hoping one of you can help, I'm having a similar issue and its driving me crazy. I would like to hide the post thumbnails on certain single pages/categories. Here is a link to my site http://www.wellnessbysandra.com/new
I would like to remove the thumbs on the tip pages...
any help will be greatly appreciated!
AdeleMB
Member
Posted 1 month ago #
Same as anjoid, I also want to hide post thumbnails on single posts, but only on posts using a specific category (in my case 'graphics').
Thank you for any help! :-)