• <?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

    (@marcomail)

    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 ?

    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.