Support » Themes and Templates » Retrieving wordpress info (excerpt) via HTML or JavaScript?

  • Trying this question again because I think I posted in the wrong group. Or else no one has an answer 🙁

    I am using WP as the blog on my site, but the rest is in HTML as produced by Publisher.

    I can obviously add a hyperlink to the blog front page (index.html), but what I’d like to do is have a box on my site’s (HTML) front page that has a post exerpt with a <!–more> tag or just a hyperlink to the blog page.

    I’ve searched but cannot find how I can do this. Am relatively new to both HTML and CSS, but have made good progress so far — but am stumped on this one.

    Is it doable?

    Thanks in advance,

Viewing 4 replies - 1 through 4 (of 4 total)
  • If the “front page” can be altered to a PHP document (i.e. index.php), adding content from WordPress is simple, because turning a regular page into a WordPress one just involves adding this right at the top:


    If your blog resides in a subdirectory, say “/blog”, then you change it to:


    Then to include a recent post on the front page, add something like this where you want it to appear:

    $posts = get_posts('numberposts=1');
    foreach ($posts as $post) :
    <h3><a href="<?php the_permalink(); ?>"><?php the_title() ?></a></h3>
    <?php the_excerpt() ?>

    Play with the layout–look at your blog’s index template to see the tags you presently use on it.

    Thanks, Kafkaesqui – This did work!

    It was easy to turn the index page into php, but I confess it took me several hours to figure out where in the file the extra code should go. I finally figured it out, though, and have it just like I wanted it (If you want to see it, it’s at

    It’s a bit of a workaround, as Publisher automatically creates its own .pub files which are then automatically turned into HTML — so I won’t be able to reopen this in Publisher to edit; but since I only plan on having the extracts on the indext page (outside of the WP pages), now that I’ve kinda figured it out, I figure I can hand edit if I need to redesign or change content in Publisher.

    Again, thanks for the help!

    A few more questions now that I’m in it:

    I switched to the_excerpt_reloaded so that I could limit the length of the content excerpts. It’s working great except for two things
    (1) I have forced_more_link set to false — the problem is that there’s no return following excerpts that are less than what’s been established — so the next excerpt title doesn’t start on a new line.
    (2) any ideas how to determine the width? I’ve tried tables, divs etc and can’t make it seem to “listen” to the parameters.

    Any help appreciated 🙂

    Perfect. As always thank Kafkaesqui.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Retrieving wordpress info (excerpt) via HTML or JavaScript?’ is closed to new replies.