0

In pages-news.php

<div class="thirteen columns"><?php 
if ( has_post_thumbnail() ) {
  the_post_thumbnail();}  ?>
  <div class="title-blog">
    <h2><a href="<?php the_permalink() ?>"> <?php the_title(); ?> </a></h2>
</div><?php 
if( in_array( $post->ID, array() )) {
  echo get_the_content();
} else {
  echo get_excerpt();
}?>
</div>  

In single-page-news.php

<div class="thirteen columns">
  <div class="title-single"><h2><?php the_title(); ?></h2> </div>
  <?php the_content();?>
</div>  

The pages-news.php is what I want but the single-page-news.php is wrong. For the single page of article, at first I want the_post_thumbnail, after that the title of article, and then the content. How can I do that?

3
  • 2
    Move code from former to latter?..
    – Rarst
    May 18, 2013 at 20:01
  • The result is the same. <?php the_content();?> has the_post_thumbnail.
    – user24259
    May 18, 2013 at 20:07
  • what theme is that? the_content() does normally not show the featured image.
    – Michael
    May 18, 2013 at 20:13

1 Answer 1

0

This seems too simple. I am afraid that I have badly misunderstood something. Apologies if that is the case.

Alter single-page-news.php to be...

<div class="thirteen columns"><?php
  the_post_thumbnail(); ?>
  <div class="title-single">
    <h2><?php the_title(); ?></h2>
  </div><?php
  the_content(); ?>
</div>  
6
  • I do that. For this i have : post_thumbnail->title -> post_thubnail-> text
    – user24259
    May 18, 2013 at 20:10
  • The the_post_thumbnail only shows up once in that code. Do you have a filter on the_content that might be duplicating it? Comment out the the_content() line and see what happens.
    – s_ha_dum
    May 18, 2013 at 20:13
  • No i don't have any filter. When i comment out the the_content() show only the title and post_thubnails
    – user24259
    May 18, 2013 at 20:25
  • 1
    Here you seem to say that the_content does not print the post thumbnail but above you say that the_content prints the post thumbnail, which is not normal and means you probably do have a filter. It is very, very, very hard to work out what you mean. Do you mean thumbnails with at 's'-- more than one?
    – s_ha_dum
    May 18, 2013 at 21:44
  • 1
    I thought it was something like that.
    – s_ha_dum
    May 18, 2013 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.