Title: why get post doesn&#8217;t work ?
Last modified: August 18, 2016

---

# why get post doesn’t work ?

 *  [Marcomail](https://wordpress.org/support/users/marcomail/)
 * (@marcomail)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/why-get-post-doesnt-work/)
 * `<?php
    $posts = get_posts('category=25&numberposts=8'); foreach($posts as $post):
   setup_postdata($post); $post_link = tb_post_thumb(true,$post->post_title); if(!
   empty($post_link) ) { echo "<a href=\"go.php?id=\"" . <?php the_ID(); . "\" title
   =\"" . the_title(); . "\"  target=\"_blank\">" . $post_link . "</a>" } endforeach;?
   >
 * there is an error in the echo

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Marcomail](https://wordpress.org/support/users/marcomail/)
 * (@marcomail)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/why-get-post-doesnt-work/#post-489695)
 * ok, i’ve solved, but why both the_ID() and the_title() are at the start of the
   string and not inside the corrispective tag ?
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/why-get-post-doesnt-work/#post-489728)
 * the_ID() and the_title() **already** echo their values. They should not be passed
   as variables to another PHP function (like echo).
 * You can use `$id` (or `$post->ID`) and `get_the_title()` (respectively) for your
   code.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘why get post doesn’t work ?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * Last activity: [19 years, 5 months ago](https://wordpress.org/support/topic/why-get-post-doesnt-work/#post-489728)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
