WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to add line between recent posts? (4 posts)

  1. Will Taft
    Member
    Posted 7 years ago #

    Below is the code from my sidebar.php file that displays recent posts. I think if I change the number 12 to say, 6, I can reduce the number of posts shown.

    What would I need to do to add a line between each post listing? As it is now, some post titles display on two lines, others on one. It would be easier to see the distinction between posts if there was a blank line between each one. Thanks!

    `<h2>Recent</h2>

      <?php get_archives('postbypost','12','custom','
    • ','
    • '); ?>
  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    You should be using wp_get_archives() instead:

    wp_get_archives('type=postbypost&limit=12&format=custom');

    To add a blank line or anything else, you can use the before and after parameters. Like so:

    wp_get_archives('type=postbypost&limit=12&format=custom&after=<br/>');

    And so on. Just make before and/or after = the html you want to insert there.

  3. Will Taft
    Member
    Posted 7 years ago #

    Thanks. This is what I changed it to and it works, except it does not put in the line space. Can you see my mistake?

    `<?phpwp_get_archives('type=postbypost&limit=6&format=custom&after=<br/>');?>

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    except it does not put in the line space

    What, exactly, is a "line space"? It's hard to understand what you want when you use non-standard terms.

    The <br/> adds a line break. Maybe you want it to add two of them? Like <br/><br/> or something? I don't know what you want until you explain it better.

    Or, it might be easier if you simply gave us a link to the page itself so we can see the results and see what you're talking about.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.