Użyj funkcji Function Reference/the post thumbnail w pliku single.php (jeżeli masz taki w używanym motywie).
Witam,
mam tak rozwiązane założenie, że w pliku single.php są includes do pliku theloop.php. Ten plik jest również includowany na stronie głównej, a więc z jedno pliku obsługuje dwa miejsca.
Kod jaki mam pliku theloop zamieszczam poniżej.
Jak zatem zrobić warunek, aby w pliku single.php nie wyświetlał ikony wpisu?
<?php
global $post, $query_string, $SMTheme;
query_posts($query_string);
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()) {?>
<?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(
array($SMTheme->get( 'layout', 'imgwidth' ), $SMTheme->get( 'layout', 'imgheight' )),
array("class" => $SMTheme->get( 'layout','imgpos' ) . " featured_image")
);
if (!is_single()){ ?></a><?php }
}
?>
<?php
//Post content
if (!is_single()&&!is_page()) {
smtheme_excerpt('echo=1');
?><a href='<?php the_permalink(); ?>' class='readmore'>Czytaj dalej</a><?php
} else {
the_content('');
}
wp_link_pages(); ?>
</div>
</div>
<?php endwhile; ?>
<?php if (!isset($_GET['ajaxpage'])) {?></div><?php } ?>
<?php endif; ?>
Rozwiązałem problem… przeniosłem kod z theloop do single i w single usunąłem kod odpowiedzialny z ikony. Z góry dziękuję za pomoc.