WordPress Project Status Plugin v2

Project Status: Complete

So I made a new one…
This is what adds the icons at the top of the pages if I use the ‘ProjectStatus’ shortcode.

<?php
/*
Plugin Name: Iceni - ProjectStatus
Plugin URI: http://www.icenidesign.com/
Description: Show Project Status Icon
Version: 1.0
Author: Tom Nickel
Author URI: http://twitter.com/icenidesign
License: Free to use and adapt
*/

function ProjectStatus() {
    global $post;
    $tags = get_the_tags($post->ID);
    $tagOutput = [];
	
	$ImageLocation = "https://icenidesign.com/wp-content/plugins/IceniProjectStatus";
	$ImageWidth = "300";
	$ImageHeight = "30";
	
	$ProjectComplete = '<img src="'.$ImageLocation.'/ProjectStatus_Complete.png" alt="Project Status: Complete" title="Project Status: Complete" width="'.$ImageWidth.'" height="'.$ImageHeight.'" />';
	
	$ProjectAbandoned = '<img src="'.$ImageLocation.'/ProjectStatus_Abandoned.png" alt="Project Status: Abandoned" title="Project Status: Abandoned" width="'.$ImageWidth.'" height="'.$ImageHeight.'" />';
	
	$ProjectUnderConstruction = '<img src="'.$ImageLocation.'/ProjectStatus_UnderConstruction.png" alt="Project Status: Under Construction" title="Project Status: Under Construction" width="'.$ImageWidth.'" height="'.$ImageHeight.'" />';
	
	$ProjectBacklog = '<img src="'.$ImageLocation.'/ProjectStatus_Backlog.png" alt="Project Status: Backlog" title="Project Status: Backlog" width="'.$ImageWidth.'" height="'.$ImageHeight.'" />';
	
	/*if the tags aren't empty...*/
    if (!empty($tags)) { 
	
		/*Populate the output array with the prewaffle*/
        array_push($tagOutput, '<div class="IceniDesignProjectStatusDiv">');
		
        foreach($tags as $tag) {
			
			if($tag->name == 'ProjectComplete'){
				array_push($tagOutput, $ProjectComplete);
			}
			elseif($tag->name == 'ProjectAbandoned'){
				array_push($tagOutput, $ProjectAbandoned);
			}
			elseif($tag->name == 'ProjectUnderConstruction'){
				array_push($tagOutput, $ProjectUnderConstruction);
			}
			elseif($tag->name == 'ProjectBacklog'){ 
				array_push($tagOutput, $ProjectBacklog);
			}
        }
		
		/*Populate the output array with the postwaffle*/
        array_push($tagOutput, '</div>');
    }

	/*Mash the arry into one big lump and return it as the function output*/
    return implode('', $tagOutput);
}

/*Shortcode name calls function name*/
add_shortcode('ProjectStatus', 'ProjectStatus');

Audio Switch

Project Status: Backlog

I want an audio switch, probably 4-in-4-out. I currently have a 1-in-3-out switch but I still find myself unplugging things as I want other audio sources.

These are what I can think of that I want:

  • Laptop (fixed)
  • Tablet (fixed)
  • Random
  • Headphones
  • Amp
  • I’m thinking that I want the unit to be low-profile and fit under my monitor stand.
  • It should have chunky rotary switches

Raspberry Pi Media Centre v2

Project Status: Backlog

So, I still want a raspberry Pi Media centre running Kodi that will be always on and just less cumbersome than using a PC connected to the TV.

Case £11.99:

https://www.amazon.co.uk/Zimix-Raspberry-Aluminum-Silver-Compatible/dp/B0769X2L4M/ref=asc_df_B0769X2L4M/?tag=googshopuk-21&linkCode=df0&hvadid=310762440393&hvpos=1o10&hvnetw=g&hvrand=9532750365848753016&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9045632&hvtargid=pla-565730891418&psc=1

SD Card (16GB Class 10 inc postage) £4.20:

https://www.ebuyer.com/828410-kingston-canvas-select-16gb-micro-sd-card-sd-adapter-sdcs-16gb

RPi 3B+ (inc postage) £36.99:

£53 total so far…..

WordPress Project Status Plugin

Project Status: Complete

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. 
{EDIT: This is now outdated and not supported on current WordPress versions}

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://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://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://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://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’);