Skip to content

Instantly share code, notes, and snippets.

@HowdyMcGee
HowdyMcGee / custom_attached_image_array.php
Created August 31, 2017 20:14
Return a Custom Image Array Attached to Given Post
/**
* Generate a custom array of image attachment information
*
* @param Integer $post_id
*
* @return Array(
* 'ID' => 123,
* 'title' => 'Image Title Attribute',
* 'alt' => 'Image Alt Attribute',
* 'caption' => 'Image Caption Attribute',
@HowdyMcGee
HowdyMcGee / word_count_column.php
Last active August 31, 2017 20:15
Count / Save / Add Wordcount Column to Pages
<?php
/**
* Plugin Name: Word Count Tracker
* Description: Simply saves the word count with the post.
* Version: 1.0.0
*/
if( ! defined( 'ABSPATH' ) ) {
die( 'There was a HOLE here. It\'s gone now.' );
}
@HowdyMcGee
HowdyMcGee / content_filter.php
Last active July 15, 2016 19:01
WordPress - Add Background Color Styles From Spans To Parent Element
<?php
/**
* Pre Content Save
* - IF headers have span backgrounds
* - Put that style onto the parent header
*/
function set_header_backgrounds( $content ) {
if( empty( $content ) ) {
return $content;