WordPress Plugin Annoyances
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?
Categories: Programming, Website
RSS: How to integrate feeds into your website with AJAX…
Update 10th November 2007 : Please note the code attached to this post will no longer function correctly with the latest version of SimplePie.
This post is a continuation of Integrating RSS feeds into your website…
Here I will provide the step by step instructions and code samples to make this a simple task. As explained in the previous post, Simplepie is the feed parser that we will utilise for this example.
What you will need :
- Download the Simplepie application
- Download the Prototype AJAX framework
- A little knowledge of PHP, Javascript and HTML
On the front page of the McNicholl Holdings website you will be able to see the end result of this tutorial. Here is how it happens :
<div id="blog_news"><script type="text/Javascript">get_feed('blog_news');</script></div>
When the page loads the Javascript inside the div element above gets called. I have created a simple Javascript function called “get_feed” which handles the AJAX call. This will be included in the files at the end of the tutorial. Obviously you will want to include this Javascript file in your HTML in the HEAD section :
WordPress: Cordobo Green Theme with an Orange Twist…
Since I started this blog I have been contacted by a few people requesting the availability of the WordPress theme I was using.
As I did not create the theme itself (merely changed its colour) I discouraged people from using this version as I had made a lot of little changes – that I didnt believe that others would want. Andreas Jacob over at Cordobo.com actualy created the theme, but at the time it was lime green – which didnt really appeal to me. As a result, I photoshopped the images and changed the colours in the style.css file so that everything would be orange. Alas this is what you see now.
The latest version of the Cordobo Green Theme is available (its still in beta though) from the Cordobo website and there is no need or point in creating a seperate version. So I have decided to make available the images and stylesheet that can be dropped into the latest versions “styles” directory and used just as the other colours are.
For more information on the Orange Twist version of the cordobo theme click here.
If you have any questions – just let me know.
Categories: Website, Wordpress Themes
Integrating RSS feeds into your website…
Targeting users to read about your company can be a difficult proposition. Customers usually just want to know what you can provide and how you can help them. If they are not immediately interested or captivated, it is more likely than not that they will leave and not return.
By integrating a blog feed into the pages of my website I hope to coax my customers and readers into wanting to know more and therefore feel like they are closer to the company. This can make customers more loyal.
Blog software is so user friendly that it already provides the facility to enable its readers to subscribe to an RSS feed – but normal websites dont have an immediate avenue to integrate that feed and maximize its benefit. After all – it is highly likely that the people visiting my website will be the people that will be interested in how it was created, as it is a Holdings company and doesnt really provide much value.
By doing a quick search of google I can find just a couple of good, php based, RSS feed parsers available :
Simplifying template changes…
In programming my website, I have broken each component down into their individual sections. By this I mean that I have simplified the ability to update an area of the website by simply changing one file. Here is how my file structure works :
- Header module
- Footer module
- Sidebar module
- main content
The sections above shouldnt really require any explanation. By modularizing how the webpage is created I can then ensure that any changes I wish to implement in the future are made all the easier – because I simply have to update one file.
Learning AJAX with the Prototype Framework…
The Prototype Framework has been selected as my framework of choice for implementing the AJAX version of my website. It abstracts the need to invest time in how the background operations in an AJAX call and subsequent element update happens.
As I am currently an expert in progress, I cannot say with any great conviction that the Prototype framework is the answer to all my prayers, but as far as first impressions go…. I am impressed.
When AJAX meets a contact form…
So, I have been busy with my full time job lately and when I get home its a bit of a struggle to get back in gear so that I can work on the site. I am a very persistent guy – so I’m battling through it.
I’ve been wanting to create my contact form for the past 2 weeks but getting the time has been difficult. I am glad to say it is now complete. I do have a basic concern that it is not 100% spam protected so I will be relying on my emails spam filter to catch the most of it until I can address the issue in the future. At the moment it is more important to have some facility for feedback than none at all.
It is currently a simple run of the mill contact form. A user enters their name, email address x2, selects a subject and then fills in their question/request. This is as good as it gets. Its how it works in the background that I am wanting to change.
An AJAX implementation is now the standard for all websites to achieve and I am setting my sites on converting mcnicholl.com to meet that standard.
Creating the Website…
Since this blog is more of a companion to the main business than the actual business itself, I couldn’t use it as the main home page for mcnicholl.com. Instead I had to create one myself. For the average web designer out there, throwing together a mock up of a website is a relatively easy task. Programmers tend to make the worst GUI’s possible, caring more for the functionality of the product than how it looks. Instead of gracefully glancing the brush across the canvas, I would hold the side of the easel and feverishly scribble.
The design of the website is, though, my own work. I couldn’t justify spending money unnecessarily at this stage of the project and I feel that the site is perfectly adequeate until money is available for a more professional twist.
As of the time of writing, it is still not completely finished. I have to complete the following pages :
- Portfolio
- Advertise
- About Us
- Contact
- Index (just a touch up here and there. I dont feel like its quite finshed yet.)
Reading that list actually hits it home that the site is currently only 45% complete.
I created the website with my favourite text editor Notepad++ . Using CSS and HTML and my trusty sidekick – photoshop. Obviously I made frequent reference to W3schools.com.
I tried using the Gimp (alternative to photoshop) – but I just felt it was inadequate. If they hired a professional GUI designer – I’d bet it would be 100 times as popular.
With the other 55% still to go, I’ll call it a work in progress and let you know when it is finally complete.