Support » Themes and Templates » Display Featured Image in index.php

  • I’m trying to create my own theme (based on standards of WP).

    Many things are right, but the home page list that I want no ! I change the default list of site, to show

    thumb
    title
    post data
    category

    The Thumb option, based in Featured Image dont work. If I use has_thumbmail always receive FALSE (yes, I edit some post and choose an image was Feature Image por post).

    I saw the documentation about it, and change but nothing. Links that I used:

    https://codex.wordpress.org/Function_Reference/add_theme_support
    http://www.sitepoint.com/how-to-add-featured-image-thumbnails-to-your-wordpress-theme/

    The code from template.php

    <?php if ( 'post' == get_post_type() ) : ?>
    <div class="entry-meta">
    <?php
    echo('Has Thumbnail: ' . has_post_thumbnail());
    if ( has_post_thumbnail() )
    {
    the_post_thumbnail();
    }
    ?>
    <?php twentyeleven_posted_on(); ?>
    </div><!-- .entry-meta -->
    <?php endif; ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Some idea ???

Viewing 6 replies - 1 through 6 (of 6 total)
  • Are you working on the index.php or template.php?

    Thread Starter mcunha98

    (@mcunha98)

    I’m working on template.php

    You want to show feature image in homepage or inner page.

    Thread Starter mcunha98

    (@mcunha98)

    In homepage

    How do you include the template.php in index.php?

    Thread Starter mcunha98

    (@mcunha98)

    I found this piece of code, and understood that I need to change the template page:

    My template is based on Twenty Eleven default theme:

    <?php if ( have_posts() ) : ?>
    
    				<?php twentyeleven_content_nav( 'nav-above' ); ?>
    
    				<?php /* Start the Loop */ ?>
    				<?php while ( have_posts() ) : the_post(); ?>
    					<?php get_template_part( 'content', get_post_format() ); ?>
    				<?php endwhile; ?>
    
    				<?php twentyeleven_content_nav( 'nav-below' ); ?>
    
    			<?php else : ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display Featured Image in index.php’ is closed to new replies.