• Resolved keress

    (@keress)


    I’ve found this code to bring in the titles and links to the latest three blogs on our site:

    <div class=”latest-blogs”>
    <?php wp_get_archives(‘type=postbypost&limit=3&format=latest-blog’); ?>
    </div>

    I need to know how to add formatting so that each title is on its own line, separated either by a <p> or a

    • (preferably a
    • )

      Can anybody tip me off on how to do this?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Instead of trying to add HTML, consider using CSS styling instead.

    Give a link to your blog, so we can see the HTML being generated.

    also, that would be like, latest-blogs a , or latest-blogs h4, h2, h1

    and so on, you would create these styles in the theme style.css file and see what happens
    and if you are on mac try using cssEdit

    Thread Starter keress

    (@keress)

    Thanks for the speedy replies. This is the page. It’s the green section under the large photo “Latest from the blog.” If you’ll check the source, I’m not able to add at least a line break between the links.

    https://www.addiva.net/blog/home/

    how about

    .latest-blogs a {
    	line-height: 22px;
    }

    Thread Starter keress

    (@keress)

    That would make it look a little better, but what I’m aiming for is something like:

    • It’s not easy being green, especially for ADD women
    • ADHD Hummingbirds?
    • Proud mom of an ADDiva-in-training

    Thanks!

    well adding this

    list-style-type: disc;

    should do the trick

    Thread Starter keress

    (@keress)

    But there are no <li>s there. I can’t figure out how to get this tag I found in the codex:

    <?php wp_get_archives('type=postbypost&limit=3&format=latest-blogs'); ?>

    to output a list instead of a big run on sentence like it is. There’s nothing there to create a list with any kind of line break. I’d settle for a simple <br /> at this point.

    Thread Starter keress

    (@keress)

    Does wordpress have a tag that will generate an ~ordered~ list of blog titles/links rather than this unordered one?

    i don’t think so, lists and so on are generated because they are in a tag such as

    Thread Starter keress

    (@keress)

    Found it! It’s

    <ul>
     <?php
     global $post;
     $myposts = get_posts('numberposts=4&offset=1');
     foreach($myposts as $post) :
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
     </ul>

    see its in a

    • tag thats what putting it in a list, glad you have found it, very useful actually ??
    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    <?php wp_get_archives(‘type=postbypost&limit=3&format=latest-blogs’); ?>

    What is that “format=latest-blog” bit for? If you remove that, you’ll get it in a list format.

    <ul class="latest-blogs">
    <?php wp_get_archives('type=postbypost&limit=3'); ?>
    </ul>
Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Adding formatting to a template tag’ is closed to new replies.