Skip to content

Instantly share code, notes, and snippets.

View jesgs's full-sized avatar
🍜
Ramen connoisseur

Jess Green jesgs

🍜
Ramen connoisseur
View GitHub Profile
@jesgs
jesgs / class.image-size.php
Last active December 14, 2015 09:39
Image size class for WordPress
<?php
/**
* ImageSizes
* Define and create image sizes
*
* @todo Add setter method for adding image sizes
*
* @package ImageSizes
* @author Jess Green <jgreen@psy-dreamer.com>
* @version $Id$
<?php
/**
* Add image sizes to Insert Into Post list
* @see http://goo.gl/CJdR4
*
* @param array $sizes
* @return array
*/
add_filter('image_size_names_choose', 'display_image_size_names', 11, 1);
function display_image_size_names($sizes)
add_filter("mce_external_plugins", "tomjn_mce_external_plugins");
function tomjn_mce_external_plugins($plugin_array){
$plugin_array['typekit'] = get_template_directory_uri().'/typekit.tinymce.js';
return $plugin_array;
}
@jesgs
jesgs / jesgs-print.css
Last active December 15, 2015 13:28
Print stylesheet from Jes.Gs
/*------------------------------------------------------------------------------
Document : print
Created on : Mar 22, 2013, 7:08:58 PM
Author : Jess Green <jgreen at psy-dreamer.com>
Description: Basic print stylesheet for single posts and pages
------------------------------------------------------------------------------*/
@page {
margin: 1in;
}
SELECT DISTINCT * FROM wp_users u
LEFT JOIN wp_usermeta um ON u.ID = um.user_id
WHERE um.meta_key = 'last_name' ORDER BY um.meta_value ASC;
<?php
define('PLUGIN_PATH', plugin_dir_path(__FILE__));
function my_template_function($id, $size = "", $title = "", $caption = "")
{
$template = locate_template(array('my-theme-template.php'));
$found_template = ($template == '')
? $template
<?php
/**
* WordPress Sandbox
*
* @package WordPress_Sandbox
* @subpackage current-screen-test
* @author Jess Green <jgreen@psy-dreamer.com>
* @version $Id$
*/
<?php
add_filter('gform_field_content', 'add_placeholder_attr', 10, 3);
/**
* Add a placeholder attribute to text inputs
*
* @param string $content
* @param array $field
* @param mixed $value
@jesgs
jesgs / the_title-filter.php
Created October 7, 2013 17:35
The author was lazy today...
<?php
add_filter('the_title', '_correct_empty_title', 10, 2);
/**
* Add snarky filler title for posts without titles
*
* @param string $title WordPress post title
* @param int $id WordPress post ID
* @return string
*/
<?php
/**
* Change order parameter
* @param WP_Query $query WP query object
*/
function mangapress_change_archive_order($query)
{
$query->query['order'] = 'ASC';
}
add_action('pre_get_posts', 'mangapress_change_archive_order')