Skip to content

Instantly share code, notes, and snippets.


David Wells DavidWells

View GitHub Profile
DavidWells / Wordpress :: Add jQuery Script with enqueue
Created Dec 4, 2012
Wordpress :: Add jQuery Script with enqueue
View Wordpress :: Add jQuery Script with enqueue
/** Add jquery script for responsive slider
This is for use with a child theme!
If not use: get_template_directory_uri() instead
function fws_add_the_scripts() {
get_stylesheet_directory_uri() . '/js/responsiveslides.min.js',
DavidWells / get_all_post_meta.php
Created Dec 4, 2012
WordPress :: Get All Post Meta
View get_all_post_meta.php
<h3>Get All WordPress Post Meta</h3>
<?php $getPostCustom=get_post_custom(); // Get all the data ?>
foreach($getPostCustom as $name=>$value) {
echo "<strong>".$name."</strong>"." => ";
foreach($value as $nameAr=>$valueAr) {
View HTML-5-Page_defaults.html
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="">
DavidWells / WordPress-Queued-Styles.php
Created Dec 10, 2012
WordPress :: View Queued Styles
View WordPress-Queued-Styles.php
add_action('wp_head', 'debug_styles_queued');
function debug_styles_queued() {
global $wp_styles;
echo '<!--- Styles QUEUED'."\r\n";
foreach ( $wp_styles->queue as $styles ) {
echo "\r\nStyle: ".$styles."\r\n";
echo "\r\n--->";
DavidWells / jQuery :: Add Visual Element Selector for Frontend
Created Dec 12, 2012
jquery to add hover elements to every item on the page
View jQuery :: Add Visual Element Selector for Frontend
$(document).ready(function() {
$('head').append('<style type="text/css">.outline-element {outline: 1px solid #c00;}.outline-element-clicked {outline: 1px solid #0c0;}</style>');
$('body').bind('mouseover mouseout click', function(event) {
var $tgt = $(;
if (!$tgt.closest('.syntax_hilite').length) {
$tgt.toggleClass(event.type == 'click' ? 'outline-element-clicked' : 'outline-element');
View Javascript :: Get, Overline and Display Div Names on Page
javascript: var t = document.getElementsByTagName('div');
for (i = 0; i < t.length; i++) {
void(t[i].style.padding = '5px;');
b = t[i].id;
h = t[i].innerHTML;
void(t[i].innerHTML = '<p style=\'color:red;font-weight:bold;\'>' + b + '</p>' + h);
void(t[i].style.border = '2px solid red');
DavidWells / jquery.responsive-media-query-helper.js
Created Dec 13, 2012
jQuery :: Responsive Design Media Query Helper Function
View jquery.responsive-media-query-helper.js
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
$(function() {
DavidWells / Dynamic-Clear-PNG.php
Created Dec 15, 2012
PHP :: Create a Dynamic Colored Transparent .png file
View Dynamic-Clear-PNG.php
// file: image.php
// Dynamically Create a clear png for css background opacities
header("Content-type: image/png");
$hex_value = $_GET['hex'];
// Convert Hex to RGB Value
function HexToRGB($hex) {
$hex = ereg_replace("#", "", $hex);
$color = array();
DavidWells / wp-add-visual-editor-meta-box.php
Created Dec 20, 2012
WordPress :: Custom Additional Custom WYSIWYG Metabox
View wp-add-visual-editor-meta-box.php
<?php // Add additonal edit box:
define('WYSIWYG_META_BOX_ID', 'my-editor');
define('WYSIWYG_EDITOR_ID', 'myeditor'); //Important for CSS that this is different
define('WYSIWYG_META_KEY', 'extra-content');
add_action('admin_init', 'wysiwyg_register_meta_box');
function wysiwyg_register_meta_box(){
add_meta_box(WYSIWYG_META_BOX_ID, __('Top Box', 'wysiwyg'), 'wysiwyg_render_meta_box', 'post');
add_meta_box(WYSIWYG_META_BOX_ID, __('Top Box', 'wysiwyg'), 'wysiwyg_render_meta_box', 'page', 'normal');
add_meta_box(WYSIWYG_META_BOX_ID, __('Top Box', 'wysiwyg'), 'wysiwyg_render_meta_box', 'services-page', 'normal'); // add to custom post type
DavidWells / get_admin_screen_data.php
Created Dec 24, 2012
WordPress :: GET Current Screen Data for conditional admin
View get_admin_screen_data.php
$screen = get_current_screen();
echo "<pre>";
echo "</pre>";