Remove thumbnail inside the post

Latest Reply from tom4ek at 2015-07-17 12:28:08 Solution
Hi,

i want to remove featured image inside a post, but still have one on the main page. I noticed similar thread here, but the code proposed by your support was different from code inside theloop.php in my theme.

here is original code from theloop.php file:
<?php // Post featured image
if(has_post_thumbnail()) {
if (!is_single()){ ?><a href="<?php the_permalink(); ?>" title="<?php printf( $SMTheme->_( 'permalink' ), the_title_attribute( 'echo=0' ) ); ?>"> <?php }
the_post_thumbnail(
'post-thumbnail',
array("class" => $SMTheme->get( 'layout','imgpos' ) . " featured_image")
);
if (!is_single()){ ?></a><?php }
}

?>


How can i remove thumbnail inside a post?
Hi!
Here is a solution for you - https://smthemes.com/support/topic/removethumbnail/#post-6519. This instruction is perfect for your theme.
Hi Alice!

thank You for your response. I have seen mentioned topic, but my theloop.php file looks a little bit different, there is no such code like:\
else { ?>
<?php the_post_thumbnail(
array(278, 173),
array("class" => $SMTheme->get( 'layout','imgpos' ) . " featured_image")
); ?>
<?php }


here is my theloop.php:
<?php 
global $post, $query_string, $SMTheme;





if (have_posts()) :




if (!isset($_GET['ajaxpage'])) {?> <div class='articles'> <?php }




while (have_posts()) : the_post(); ?>
<div class='one-post'>
<div id="post-<?php the_ID(); ?>" <?php post_class("post-caption"); ?>>
<?php //Title
if (!is_single()&&!is_page()) { ?>
<h2><a href="<?php the_permalink(); ?>" title="<?php printf( $SMTheme->_( 'permalink' ), the_title_attribute( 'echo=0' ) ); ?>" class='post_ttl'><?php the_title(); ?></a></h2>
<?php } else { ?>
<h1><?php the_title(); ?></h1>
<?php }


//Post meta (comments, date, categories)
if (!is_page()) {?><p class='post-meta'>

<span class='post-date'><?php echo get_the_date(); ?></span>,

<?php echo $SMTheme->_('before-category'); ?><?php the_category(', ');

if(comments_open( get_the_ID() )) {
?> | <span class='post-comments'><?php comments_popup_link( $SMTheme->_( 'noresponses' ), $SMTheme->_( 'oneresponse' ), $SMTheme->_( 'multiresponse' ) ); ?></span>
<?php }
edit_post_link( $SMTheme->_( 'edit' ), ' | <span class="edit-link">', '</span>' );
?>

</p><?php } ?>

</div>
<div class='post-body'>

<?php // Post featured image
if(has_post_thumbnail()) {
if (!is_single()){ ?><a href="<?php the_permalink(); ?>" title="<?php printf( $SMTheme->_( 'permalink' ), the_title_attribute( 'echo=0' ) ); ?>"> <?php }
the_post_thumbnail(
'post-thumbnail',
array("class" => $SMTheme->get( 'layout','imgpos' ) . " featured_image")
);
if (!is_single()){ ?></a><?php }
}

?>







<?php
//Post content
if (!is_single()&&!is_page()) {
if ( ! post_password_required() ) { smtheme_excerpt('echo=1'); } else the_content('');
?><a href='<?php the_permalink(); ?>' class='readmore'><?php echo $SMTheme->_( 'readmore' ); ?></a><?php
} else {
the_content('');
}
wp_link_pages(); ?>
</div>
</div>




<?php endwhile; ?>





<?php if (!isset($_GET['ajaxpage'])) {?></div><?php } ?>






<?php endif; ?>


I have changed mentioned code portion to
<?php // Post featured image
if(has_post_thumbnail()) {
if (!is_single()){ ?><a href="<?php the_permalink(); ?>" title="<?php printf( $SMTheme->_( 'permalink' ), the_title_attribute( 'echo=0' ) ); ?>"> <?php }
if (!is_single()){
the_post_thumbnail(
'post-thumbnail',
array("class" => $SMTheme->get( 'layout','imgpos' ) . " featured_image")
);
}
if (!is_single()){ ?></a><?php }
}

?>

and now it works perfectly. Case closed.

Leave a reply

Add codeAdd image