Re-coding Some Plugins

Categories: Blog, Personal
Tags: , , , , , , ,

Apr 3
2011

I’ve finally had a little time to make a few major changes to two plugins that I originally developed for this site. I think the final result is good enough that I may offer it up as a free download.

The two plugins in question were the ones running the ‘Featured Project’ in the sidebar and the ‘Personal Project’ in the footer. There were too many issues with them – and by issues I mean there wasn’t enough flexibility.

‘Featured Project’ Plugin

Originally the ‘Featured Project’ would only allow you to select from a list of posts that were in the ‘portfolio’ category. The theme was required to have post-thumbnails support and then even a specific size for the image width and height. A caption based on the post’s title was used.

‘Personal Project’ Plugin

This plugin was nearly identical to the ‘Featured Project’ plugin except you selected your project from a list of posts.  There wasn’t enough flexibility to this plugin to be of any use to anyone other than myself.  And only if I were using the specific WordPress theme I created.

Moving Forward

There were a number of things I wanted the new plugin to do.

  • Be able to select either a page or a post.
  • Check if post thumbnails are supported by the current theme.
    • If post thumbnails are supported – choose the image size from a select list of all available post thumbnail sizes (or select no image if you wanted that).
    • If post thumbnails are not supported – just output a text link based on the selected page/post title.
  • Make the caption for the image optional.
  • Assign a unique ID to the widget so they can be styled differently in multiple instances.

The Result

The end result is the ‘DMG Current Project’ plugin which after I clean it up a bit will be released to the public.

For the most part I think I ended up with just what I was looking for.  In fact I removed the old plugins and replaced them with the new one today – and you can’t even tell the difference.

 

Comments

Leave a comment

 

Leave a comment

Read comments

 



Please do not submit your comment more than once. It will appear once it has been approved.