• Feature request: I’d prefer to not have the <?php get_links_list(); ?>function return the categories as a nested UL with assumed class ids. Since it’s possible to customize the tags output before and after each list entry, it should also be possible to customize the tags output before and after each category.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter marky

    (@marky)

    Sadly, that’s not what I had in mind. Specifically, using get_linksbyname() means I have to manually specify which category I want output. What I’m looking for is something that will output all categories and links, like get_links_list(), but with custom tags before and after each category.
    Also, I just tried get_linksbyname(), and it seems that the two additional parameters have no effect on the output. 🙁

    Thread Starter marky

    (@marky)

    Junesix, I tried that and nothing was output. I’m using WP 1.2.

    Thread Starter marky

    (@marky)

    I should clarify, no category names were output, the links were–but again, that’s not what I had in mind. Specifically, I want to output all the categories as headers and have an unordered list of links under each header.

    Thread Starter marky

    (@marky)

    OK, I’ll rephrase my first post to clarify what I’m looking for. 🙂
    Right now the get_links_list() function returns a nested unordered list of categories and their links. The categories are simply represented as list items with a presumed class ID. That is:

      <li id="Category 1">Category 1
    • Link 1
    • Link2

    <li id="Category 2"> Category 2

    • Link 3

    Unfortunately, while you’re able to customize the tags that surround the links (replacing the LI tags with DD tags for example), you cannot customize the tags that surround the category names. What’s worse, the assumed class ID for the list items may conflict with existing styles (at worst) or be unused (at best). I would like to be able to choose what tags I want to surround both the category items and the list items. This would allow me to do the following, for example:

    <dl>
    <dt>Category 1</dt>
    <dd>Link 1</dd>
    <dd>Link 2</dd>
    <dt>Category 2</dt>
    <dd>Link 3</dd>
    </dl>

    Thread Starter marky

    (@marky)

    Thanks for the tip, junesix!
    Question: If I, or anyone else, were to modify get_links_list to take optional parameters to customize the output, would there be any chance of it being put in an official WP release? I don’t plan to dabble much in the source, but this is one of those things that I’d like in there without having to update manually after every upgrade. 🙂

    Well, the best way to go about making it upgrade-proof it is to make it a plugin. To do that, I think you would copy that function into a new .php file, give it a new function name like markys_get_links_list, make the edits, and save it to the plugins directory. Then in your files, you would call the markys_get_links_list function instead of the hacked get_links_list function.
    I haven’t taken the time to read the WP plugins documentation but I think that’s really all there is to making a new plugin, short of credits, authorship, description, comments, etc.
    Ideally, the WP dev team would catch on and rewrite the links functions to accept ‘before’ and ‘after’ parameters like other WP functions.

    I’m also interested in this modification. I tried to do it, but got parse errors. I’m not proficient with PHP, so I don’t know what I’m doing. I’ll keep checking this thread, maybe someone can post the modded links.php?

    Yeah, Id be interested in a modded links.php too since Im running into similar probs..

    crowspeaker

    (@crowspeaker)

    I am also looking for a feature in WordPress that would do this or at least a workaround or a plugin until it is available in WP.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Link Category Output Customization’ is closed to new replies.