• Hi there,

    I’ve looked around and done searches on the very excellent wiki section of this site, but I haven’t been able to find the answer to a question I have regarding the customization of my writing journal.

    The problem I have is that when I configured the wp_get_archives to list the 20 most recent posts on my journal by their title, the list doesn’t retain the html formatting of the journal title in question (if it’s been formatted at all, that is). Sometimes I will include italics in the title of a journal entry. For example, I might write “My review of American Gods, by Neil Gaiman.” I can get the title to appear under my recent posts, but I lose the italics. I’m not sure if this is something that can be fixed but I thought I would ask just in case.

    Thanks very much to anyone who reads this and responds. This looks like a great community here and I’m glad to be a part of it.

Viewing 1 replies (of 1 total)
  • In this case I’d recommend replacing wp_get_archives() with a bit of coding that duplicates the postbypost feature, but retains the HTML in your titles. This is actually a good use for get_posts(). The following displays the last 20 post titles as links (in li(st) tags):

    <?php
    $archives = get_posts('numberposts=20');
    foreach ($archives as $post) :
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘How to retain text formatting in listing of recent posts’ is closed to new replies.