WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] listing post titles and links on home page (5 posts)

  1. loco2402
    Member
    Posted 2 years ago #

    Hello,

    Still kinda new to WP...

    I want to be able to list recent blog posts by just the title in a section of my home page, much like Texas Monthly does (see BurkaBlog and Eat My Words in lower left of page). My home page is outside the WP directory.

    Would like to know which parts of the PHP to grab and place in the home page to get this to work, if that is possible.

    Thanks in advance.

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    Have you tried using the Recent Posts widget in Appearance -> Widgets?

  3. loco2402
    Member
    Posted 2 years ago #

    I have not, as my home page is the root index.html, outside the WP directory and static (but easily converted to PHP). I am unsure what code I need to add to this page to just pull the last 2 - 3 post titles.

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    Ah! In that case have a look at integrating WordPress with your web site.

  5. loco2402
    Member
    Posted 2 years ago #

    I found the solution, and frankly didn't think it would be this easy. I have looked at the page esmi referenced numerous time, but in my inexperience, never thought to try the code samples at this location on that page. It does exactly what I have been looking for for over a week. : P

    I put

    <?php
    require('/the/path/to/your/wp-blog-header.php');
    ?>

    at the top of my home page, and

    <?php query_posts('showposts=3'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a><br />
    <?php endwhile;?>

    in the DIV I wanted it to show up. And it worked.

Topic Closed

This topic has been closed to new replies.

About this Topic