Support » Fixing WordPress » Remove Featured Image from Post Template

  • Resolved elatedmonk

    (@elatedmonk)


    Hi,

    I’ve been trying without success to remove the featured image from showing up on a blog post using a post style template.

    I want there to be a featured image for other areas of the site, but don’t want it to show up on the page. Not necessarily all the time, so I wanted to make a post template that does this so I can choose when making my posts.

    Any ideas?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The Codex is a good read and includes this:

    http://codex.wordpress.org/Page_Templates

    It is easier te help you if you give us more information: what is the link to your website and/or which theme are you using?

    MattyWP

    (@mattywordpress)

    locate your theme folder and open the index.php file.

    Look for this line and remove it:

    <?php the_post_thumbnail(single-post-image); ?>

    Thread Starter elatedmonk

    (@elatedmonk)

    I ended up making a post template named: template-news-posts.php

    Then using this code:

    <?php
    /*
    Template Name: Blog list - News
    */
    ?>
    <?php get_header(); ?>
    <div class="contents-wrap float-left two-column">
    	<?php
    
    	if ( get_query_var('paged') ) {
    	$paged = get_query_var('paged');
    	} elseif ( get_query_var('page') ) {
    	$paged = get_query_var('page');
    	} else {
    	$paged = 1;
    	}
    
    	$args = array(
    	'paged='.$paged,
    	'showposts' => '',
    	'posts_per_page' => '',
    	'tax_query' => array(
    			array(
    				'taxonomy' => 'post_format',
    				'field' => 'slug',
    				'terms' => array('post-format-news')
    				)
    			)
    	);
    	query_posts( $args );
    	?>
    	<div class="entry-content-wrapper">
    	<h1 class="entry-title"><?php the_title(); ?></h1>
    	<?php get_template_part( 'loop', 'blog' ); ?>
    	</div>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    I created the template to be selected in the post form. I then added a file in my includes/postfomats called news.php

    <div class="entry-post-wrapper">
    <?php
    	get_template_part( 'includes/postformats/post-contents' );
    	get_template_part( 'includes/postformats/post-data' );
    ?>
    </div>

    With that I never called for the featured image and so it’s not displayed on page. Only the contents and data for the page, fitting into the page format already.

    Thanks for the codex comment, it walked me through removal for post specific templates.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove Featured Image from Post Template’ is closed to new replies.