删除帖子中的精选图片

时间:2013-10-29 04:50:46

标签: wordpress

我想删除帖子和页面中的精选图片,但请将其保留为缩略图,以便网站看起来不错!我的网站是一个基于wordpress的网站。

以下是该网站的示例帖子:http://www.tradingspotsilver.com/build-mt4-custom-ea-indicator-forex-free/

您可以看到特色图片位于帖子顶部并占据了大量空间。我试着看看主题来源,但没有运气。

7 个答案:

答案 0 :(得分:1)

您的问题中给出的链接是一个帖子页面,您查看主题的根文件夹并找到一个名为single.php的文件,在该文件中您可能会找到类似这样的文件

// "custom_size" could be anything like "single_page_image"
if ( has_post_thumbnail() ) : the_post_thumbnail('custom_size');

这行代码负责显示大图像。只需删除此行,您的图片就不会显示出来。另外,您可以检查this answer以查看自定义图像大小。

对于页面模板,您可以查找名为page.php的文件并查找类似的代码。

答案 1 :(得分:0)

你可以使用timthumb来调整大小:

代码在此处:{https://code.google.com/p/timthumb/source/browse/trunk/timthumb.php}

在主题文件夹中创建名为timthumb.php的文件,并在特色图片php脚本的位置键入:

if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
              //the_post_thumbnail();
            $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>
            <div class="img-hold"> <img src="<?php bloginfo('template_directory') ?>/timthumb.php?src=<?php echo $url; ?>&w=219&h=125" width="219" height="125"  /></div>
            <p><?  } 
                echo $content;  
            ?></p>

根据您的意愿更改高度和宽度的值&amp; w =,&amp; h =和width =,height =

希望这会有所帮助

答案 2 :(得分:0)

只需删除single.php和page.php或content.php中的the_post_thumbnail代码即可。 此功能在中用于show feature,只需删除或评论即可。

答案 3 :(得分:0)

检查你的single.php和content.php页面以解决这个问题吧

如果你不需要代码注释它/或根据需要修改它。 不要把事搞得一团糟,否则你最终会收到错误

答案 4 :(得分:0)

我有同样的问题,我在single.php中找不到任何解决方案

虽然很简单:

只是评论:

来自content.php页面

答案 5 :(得分:0)

这是Dazzle主题 我在&#34; content-single.php中找到并删除了:

<?php the_post_thumbnail( 'dazzling-featured', array( 'class' => 'thumbnail' )); ?>

图片已从帖子中消失。

答案 6 :(得分:0)

这显然取决于主题。

对于主题免费增值,您需要删除 wp-content / themes / freemium / single.php 中的以下行:

  <?php $freemium_feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); if($freemium_feat_image!="") { ?>
                <img src="<?php echo $freemium_feat_image; ?>" alt="Banner" class="img-responsive img-responsive-freemium" />
                <?php } ?>