• I’ve been looking around for a way to include a ID or Class to the link generated by the wp_list_bookmarks.

    I thought I could use the “notes” area to store the name of the ID (or Class).

    I was the trying to filter this into the wp_list_bookmarks via my functions.php, but my PHP skills are too few, so I ended up with hacking the core file bookmark-template.php by adding this snippet around line 90.

    $id = $bookmark->link_notes;
    if ( ” != $id )
    $id = ‘ id=”‘ . $id . ‘”‘;

    and putting the $id in the output a few lines down.

    Sure it works, but can anyone point out if it is possible to do this via the functions.php instead of this non-bulletproof method?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • bump.

    ok so i found a solution to get ID’s/classes added to my links, but i had to use get_bookmarks instead of wp_list_bookmarks … the method i used is based on this dude’s custom array found here

    here’s what i came up with:

    <?php
    $bookmarks = get_bookmarks( array('category_name'=>'About'));
    foreach ( $bookmarks as $bookmark ) {?>
    <li id="link-<?php echo $bookmark->link_id; ?>">
    <a title="<?php echo $bookmark->link_name; ?>" href="<?php echo clean_url($bookmark->link_url); ?>" target="_blank"><?php echo $bookmark->link_name; ?></a>
    </li>
    <?php } ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filter id/class into wp_list_bookmarks?’ is closed to new replies.