WordPress.org

Ready to get started?Download WordPress

Forums

Link Category Output Customization (10 posts)

  1. marky
    Member
    Posted 9 years ago #

    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.

  2. marky
    Member
    Posted 9 years ago #

    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. :-(

  3. marky
    Member
    Posted 9 years ago #

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

  4. marky
    Member
    Posted 9 years ago #

    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.

  5. marky
    Member
    Posted 9 years ago #

    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>

  6. marky
    Member
    Posted 9 years ago #

    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. :-)

  7. junesix
    Member
    Posted 9 years ago #

    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.

  8. mattjb
    Member
    Posted 9 years ago #

    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?

  9. Sumaira
    Member
    Posted 9 years ago #

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

  10. crowspeaker
    Member
    Posted 8 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.