Wordpress Plugin Annoyances

Posted on February 7th, 2008 in Programming, Website by mcnicholl

Creating a plugin for wordpress can be an extremely simple task, or altogether annoying.

I’ve recently been creating a plugin for “Featured” content on a new site that I’m pushing at the moment. Basically the plugin works like this :

  • Featured Posts belong to the “Featured” Category
  • Featured content can be controlled by the plugin menu in the Wordpress Admin screen (updated by Editor or Administrator)
    • This is important as you dont want to have to sift through a list of 1000 posts to see which are marked as Featured or not - Even with the filter active this can be annoying
  • The Featured content can only be “Featured” if it is part of another category.
    • i.e Lets say the purpose was for books (Fiction and Non-Fiction). The Featured section might only cater for Fiction books. So the posts would be in Featured and Fiction categories. Simple.
  • The admin area can state the total amount of Featured posts.

The plugin then provides functions to the template to output the featured content.

One issue I had was using query_posts to select the posts that were not featured but in the chosen category (Fiction). The plugin function :
query_posts('category_name=Fiction&category_name=-Featured')
…just wouldnt work. I tried many variations of the query_post command along with category_name only to discover that wordpress does not facilitate anything more than basic requirements when using category_name. So, I retreat to using ‘cat’ instead. Boo! Now I have to query the database to get the ids of the categories I want to query on first. Not exactly efficient. Not to mention using more memory with additional variables to accommodate this etc.

Any other annoyances that you have encountered?

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Furl
  • Reddit
  • Slashdot
  • Technorati
  • StumbleUpon

Post a comment