Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm creating a script that will remove the default "Blogroll" links in Links manager and replace them with an arbitrary listing of links, each with a custom css style name.

It my case, I'll be replacing them with my list of social media links and icons.

In order to make this truly dynamic, I'll be seeding the links from a customizable text file which the plugin owner can edit and place inside the plugin before its installed and activated.

For example, the default blogroll.txt file would look like this:

<ul class="social">
<li class="twitter"><a href="http://twitter.com" />Twitter</a></li>
<li class="facebook"><a href="http://facebook.com" />FaceBook</a></li>
<li class="youtube"><a href="http://youtube.com" />YouTube</a></li>
<li class="linkedin"><a href="http://linkedin.com" />LinkedIn</a></li>
</ul>

And I'm creating a script that will parse this content and for each list item, it will use wp_insert_link() to add the list item to the "Links" listing.

The only problem I have is that there's no way to insert a custom css class to define each link. This is needed so that the appropriate icon can be attached to the link.

Perhaps I could use the "image address" field to do this, but css would be my preference.

How would one assign a css class id or name to each link that's created?

share|improve this question
add comment

1 Answer

Why not loop through the bookmark ID's and assign it to a div, along the lines of <div id="bookmark-<?php $bookmark_id(); ?> using get_bookmark to get the ID's, $bookmark_id = get_bookmark(....);

share|improve this answer
    
Sounds interesting. Are you inferring a runtime filter? –  Scott B Mar 31 '11 at 18:08
    
Ya I guess my example is for runtime, I am so used to using the loop for everything it might not be applicable to your script, any reason you don't make a widget for this? –  Wyck Mar 31 '11 at 19:57
    
I want to leverage the existing "Link" manager since its so robust. I don't want to have to reinvent that UI. So, I'm just looking to reset the existing blogroll links with ones that are more meaningful to me (and others I'm guessing) –  Scott B Mar 31 '11 at 21:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.