1

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?

1 Answer 1

1

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(....);

3
  • Sounds interesting. Are you inferring a runtime filter?
    – Scott B
    Mar 31, 2011 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, 2011 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, 2011 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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