WordPress Project Status Plugin

[fearpigprojectstatus]

You may have noticed that each project page has a status at the top of it. This used to be set on each page manually but turned out to be a pain keeping track of it. 

So….. I decided to write my own plugin and shortcode! Its actually fairly easy. 

Status Icons

These are the different icons I have:

Complete
Project Status: Abandoned
Project Status: Abandoned
Project Status: Under Design

Shortcode

This is the shortcode that I use:
fearpigprojectstatus

Tags

These are the tags that it uses:

  • ProjectComplete
  • ProjectAbandoned
  • ProjectUnderConstruction

Plugin Code

This needs to be uploaded to the plugin directory (in its own subfolder of the same name for neatness) and then activated through the Plugin Page.

And here is the full code, its fairly self explanatory but basically if the project has one of the above tags then it adds the relevant icon at the point the shortcode is written (I put them at the top of the page), if one of those tags isn’t present then it adds the Under Design icon.

One benefit of this is that I can now also use the Display Posts Shortcode plugin to list completed, abandoned and under construction pages.

<?php
/*
Plugin Name: Fearpig – Project Status
Plugin URI: http://icenidesign.com
Description: This plugin puts an image on the page based on a status the project is tagged with! Shortcode: fearpigprojectstatus Options: ProjectComplete, ProjectAbandoned, ProjectUnderConstruction
Version: 1.0
Author: Tom Nickel
Author URI: http://icenidesign.com
*/

function wp_fearpigprojectstatus_shortcode(){
if ( has_tag( ‘ProjectComplete’ ) ) {
// The current post has the tag “ProjectComplete”;
echo ‘<p><img src=”https://fearpig.icenidesign.com/wp-content/plugins/Fearpig-ProjectStatus/ProjectStatus_Complete_v21.png” alt=”Complete” title=”ProjectStatus_Complete_v2″ width=”268″ height=”60″ class=”alignnone size-full wp-image-105″ /></p>’;
} elseif ( has_tag( ‘ProjectAbandoned’ ) ) {
// The current post has the tag “ProjectAbandoned”;
echo ‘<p><img src=”https://fearpig.icenidesign.com/wp-content/plugins/Fearpig-ProjectStatus/ProjectStatus_Abandoned_v21.png” alt=”Project Status: Abandoned” title=”Project Status: Abandoned” width=”268″ height=”60″ class=”alignnone size-full wp-image-104″ /></p>’;
} elseif ( has_tag( ‘ProjectUnderConstruction’ ) ) {
// The current post has the tag “ProjectUnderConstruction”;
echo ‘<p><img src=”https://fearpig.icenidesign.com/wp-content/plugins/Fearpig-ProjectStatus/ProjectStatus_UnderConstruction_v21.png” alt=”Project Status: Abandoned” title=”Project Status: Abandoned” width=”268″ height=”60″ class=”alignnone size-full wp-image-104″ /></p>’;
} else {
// The current post has no project tags and is “ProjectUnderDesign”;
echo ‘<p><img src=”https://fearpig.icenidesign.com/wp-content/plugins/Fearpig-ProjectStatus/ProjectStatus_UnderDesign_v21.png” alt=”Project Status: Under Design” title=”ProjectStatus_UnderDesign_v2″ width=”268″ height=”60″ class=”alignnone size-full wp-image-107″ /></p>’;
}
}
add_shortcode(‘fearpigprojectstatus’, ‘wp_fearpigprojectstatus_shortcode’);