Replace default Blogroll Links with Social Media Links

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.

Read More

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?

Related posts

Leave a Reply

1 comment

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