Support » Themes and Templates » Erro = Widget Recent Post?

  • Hi, guys! ;D

    I create a theme for my blog with widgets! (i lv widget! *-*)
    But… When i put the code for to get the recent post… The title’s always same. (The date and the comment change @_@)

    But, i put the same code on the sidebar.php… Appears correct!

    hmmm, why don’t it function in the widget? x-x

    the code:

    <?php $lastposts = get_posts('numberposts=3&offset=1');
    foreach($lastposts as $post) : setup_postdata($post);?>
    <div class="recent"><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a><br />
    <?php the_time('d',true); ?> de <?php the_time('F',true); ?> | <?php comments_number('no comment','1 comment','% comments'); ?></div>
    <?php endforeach; ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • hmm… …

    someone? XD

    I’m not sure what you’re asking, but as far as I know you can’t execute PHP in widgets by default. From what I understand, that’s the problem you’re having.

    I know there are Plugins that will let you execute PHP in widgets. Samsarin PHP Widget is the first one I found, but then I’m sure there are many more that do a similar thing.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Erro = Widget Recent Post?’ is closed to new replies.