• I’m trying to display the last seven entries on my web site and almost have it except that, rather than displaying the author of each entry, it gives me the credit. If someone could take a look at this and tell me what I’m doing wrong, I’d really appreciate it.

    I have something similar in the main index area which works fine, just not in the sidebar.

    By the way, the new WordPress is unicorns, I must say.

    <?php
    $posts = get_posts(‘numberposts=7’);
    foreach ($posts as $post) :
    ?>
    <img src=”/images/authors/<?php the_author_ID(); ?>.jpg” class=”author_icon”>“><?php the_title() ?><br>
    by <?php the_author(); ?>
    <?php
    endforeach;
    ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • what do you mean credit?

    If you’re running WordPress 1.5, Try this:

    <?php
    $posts = get_posts('numberposts=7');
    foreach ($posts as $post) :
    setup_postdata($post);
    ?>
    <img src="/images/authors/<?php the_author_ID(); ?>.jpg" class="author_icon"><?php the_title() ?><br>
    by <?php the_author(); ?>
    <?php endforeach; ?>

    If you have 1.2.x, swap

    setup_postdata($post);

    with

    start_wp();

    Thread Starter edyuban

    (@edyuban)

    That did it! Woo! You may be the most awesome person alive. Remind me to send you cookies.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Last X Posts problem’ is closed to new replies.