ThemeShaper Forums » Thematic

Using "get_posts"..

(5 posts)
  • Started 4 years ago by richidi
  • Latest reply from amygail
  • This topic is not resolved
  1. richidi
    Member

    Hi.

    I know that there is way to use "get_posts" to show my posts in a static homepage. I just can't do that with my low-level php skils. So I'm asking help..

    This is what I'd like show in my site homepage:

    3 latest posts from the blog. Showing only post-title, date and the post itself.. Post_footer can be there. I used filter to customize it already.

    This "latest post" area is meant to be in page_bottom(thematic). Is that possible? Thank you already. :)

    Posted 4 years ago #
  2. richidi
    Member

    I tried this..

    <?php
    $postslist = get_posts('numberposts=10&order=ASC&orderby=date');
    foreach ($postslist as $post) :
    setup_postdata($post);
    ?>
    <div>
    <?php the_date(); ?>

    <?php the_title(); ?>
    <?php the_excerpt(); ?>
    </div>
    <?php endforeach; ?>

    Unfortunately it caused this:

    "This tag can be used anywhere within a template as long as it's outside The Loop on the main page, though is typically used in the <title> element for the head of a page." <- wp_title

    Is there any way to do this? Or should I just use latest post widget? Is there possibility to add date + excerpt to the widgets output..?

    Posted 4 years ago #
  3. amygail
    Member

    I'm probably missing something - but why don't you just use the option (in settings > reading)...

    to have the front page show 'Your latest posts' and set "Blog pages show at most" 3 posts?

    Then just list your 'latest posts' in a widget in whatever area you want? (page-bottom etc)

    Posted 4 years ago #
  4. richidi
    Member

    Becouse I've already have blog page which shows all the posts.. I just wan't have three newest in my homepage :D

    I think I should use something like this (needs little more though :D)
    <?php wp_get_archives('title_li=&type=postbypost&limit=3'); ?>

    Not get_posts..

    Posted 4 years ago #
  5. amygail
    Member


RSS feed for this topic

Reply

You must log in to post.