Outputting Blogroll
-
I’d like to output my blogroll in this format:
<h2>Category 1</h2>
<ul>
<li>Link 1</li>
<li>Link 2</li>
</ul>
<h2>Category 2</h2>
<ul>
<li>Link 3</li>
<li>Etc...</li>
</ul>I’ve played around with the template tags (specifically wp_list_bookmarks), but still can’t seem to coax the output in this format. I’m using WordPress 2.1. Can anyone help?
-
Err.. This will do what you’re asking:
<?php wp_list_bookmarks(); ?>The default settings fit exactly with what you described above.
Not quite, no.
wp_list_bookmarks()adds an encompassing unordered list around the whole lot, which isn’t really appropriate in my context.That is, the template tag outputs something along the lines of:
<ul>
<li><h2>Category 1</h2>
<ul>
<li>Link 1</li>
<li>Link 2</li>
</ul>
</li>
</ul>I want to do away with the nested lists.
No, I don’t see that it does that, but I do see what you’re talking about. It actually does this:
<li><h2>Category 1</h2>
<ul>
<li>Link 1</li>
<li>Link 2</li>
</ul>
</li>
<li><h2>Category 2</h2>
<ul>
<li>Link 1</li>
<li>Link 2</li>
</ul>
</li>In other words, it does make the list items you’re talking about, but the UL’s you have around the entire thing must come from elsewhere, because they’re not in the code as far as I can tell.
Try
wp_list_bookmarks('category_before=&category_after=');and see if that works for you.Ah, I understand now.
My apologies; I had assumed the extra UL tags were being output by the template tag, so I didn’t think the category_before and category_after parameters would have done the trick.
Your suggestion worked perfectly; thank you!
Hello, as for me i would like to get rid of the defualt title:blogroll
Can you tell me how to do that? It seems i’d have to use title_li but i’m not surethanks
The topic ‘Outputting Blogroll’ is closed to new replies.