WordPress.org

Ready to get started?Download WordPress

Forums

Adding tags between the image and link in wp_list_bookmarks() (5 posts)

  1. DesignFirm
    Member
    Posted 2 years ago #

    I'm using the wp_list_bookmarks() function to create a supplier resource page. Some of the links will have logos, some will not. To keep the list clean, I'd like to wrap the images that are output in <dt> tags and the link/descriptions in <dd> tags. However, none of the arguments available allow me to insert text between the image and text in the anchor tags. I've pasted my altered code here. It works, but I obviously don't want to change the original file. (The code is from the function _walk_bookmarks, which is then used by the function wp_list_bookmarks(). They're both in bookmark-template.php in the wp-includes folder.)

    This answer involving filters seems to be what I need, but I don't know PHP well enough to apply it.

    If anyone has an idea how to filter it or, failing that, a way to make it a separate function that I can use, I'd appreciate it.

    Thanks,
    Scott

  2. Charles Frees-Melvin
    Member
    Posted 2 years ago #

    I've submitted a patch to core to allow this to be done as simply as the before and afters. http://core.trac.wordpress.org/ticket/20414

  3. DesignFirm
    Member
    Posted 2 years ago #

    Thanks. What do you recommend in the interim? This is being presented to a client this weekend, but won't be handed off to them for another few weeks. Should I add in your suggested "img_after" argument to the bookmark-template file? Or should I create a separate function? (And if so, how do I do this without causing conflicts?)

    Thanks,
    Scott

  4. Charles Frees-Melvin
    Member
    Posted 2 years ago #

    In the interim you could put _walk_bookmarks and wp_list_bookmarks in a plugin file with the mods. To avoid conflict it is common to prefex your functions I usually use thee17_ in front of my function but you can use anything.

  5. DesignFirm
    Member
    Posted 2 years ago #

    Super. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic