Skip to content

Instantly share code, notes, and snippets.

View joecue's full-sized avatar
🎯
Focusing

Joe Querin joecue

🎯
Focusing
View GitHub Profile
@joecue
joecue / json-example.html
Created May 19, 2015 20:53
Sample JSON File Reading WP API Call
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
@joecue
joecue / WP_Related_Post.php
Created June 12, 2015 15:25
WordPress Related Post Code without need of plugin - Grabbed from http://jointswp.com/wordpress-related-posts-without-plugin/
<?php
// Related Posts Function, matches posts by tags - call using joints_related_posts(); )
function joints_related_posts() {
global $post;
$tags = wp_get_post_tags( $post->ID );
if($tags) {
foreach( $tags as $tag ) {
$tag_arr .= $tag->slug . ',';
}
$args = array(
@joecue
joecue / demo-plugin.php
Created July 17, 2015 18:38
Recipe Custom Post Type Plugin
<?php
/*
Plugin Name: Site Plugin for WordCamp Columbus 2015
Description: Site specific code changes for example.com
*/
/* Start Adding Functions Below this Line */
// Hook into the 'init' action
add_action( 'init', 'demo_post_types', 0 );
@joecue
joecue / announcement-demo.php
Created July 17, 2015 18:40
Announcement Custom Field (Meta Box) and Custom Post Type Example
<?php
/*
Plugin Name: Announcement Demo Plugin
Description: Site specific code changes for example.com
*/
/* Start Adding Functions Below this Line */
// Register Custom Post Type
function custom_post_type() {
@joecue
joecue / footer-add-this-line.php
Last active August 29, 2015 14:25
WordCamp Columbus 2015 - WP 201 - Demo Menu Plugin
@joecue
joecue / Gruntfile.js
Created July 18, 2015 20:27
Sample Grunt File
module.exports = function(grunt) {
SOURCE_DIR = '',
BUILD_DIR = '../../wwwroot-wp_demo_theming/wp-content/themes/demo-theme',
// Configuration Info
grunt.initConfig({
sass: {
@joecue
joecue / functions.php
Created July 18, 2015 20:28
Sample WordPress Function file showing Foundation Enqueues
/**
* Enqueue scripts and styles.
*/
function demo_wordcamp_scripts() {
wp_enqueue_style( 'demo-wordcamp-style', get_stylesheet_uri() );
/* Add Foundation CSS */
wp_enqueue_style( 'foundation-normalize', get_stylesheet_directory_uri() . '/foundation/css/normalize.css' );
wp_enqueue_style( 'foundation', get_stylesheet_directory_uri() . '/foundation/css/foundation.css' );
@joecue
joecue / functions.php
Last active November 5, 2015 14:24
Sample WordPress Child Theme functions file
<?php
/* Add Parent Theme Styles */
function demo_scripts() {
wp_enqueue_style( 'demo-framework-style', get_template_directory_uri() .'/style.css' );
/* ----- Add Foundation Support From Parent Theme ----- */
/* Add Foundation CSS */
wp_enqueue_style( 'foundation-normalize', get_template_directory_uri() . '/foundation/css/normalize.css' );
@joecue
joecue / _icons.css
Last active October 1, 2015 17:01
gulp-iconfont Configuration
/* Icon CSS Template - Used by gulp-iconfont plugin to create CSS file to use with fonts */
@font-face {
font-family: "<%= fontName %>";
src: url('<%= fontPath %><%= fontName %>.eot');
src: url('<%= fontPath %><%= fontName %>.eot?#iefix') format('eot'),
url('<%= fontPath %><%= fontName %>.woff') format('woff'),
url('<%= fontPath %><%= fontName %>.ttf') format('truetype'),
url('<%= fontPath %><%= fontName %>.svg#<%= fontName %>') format('svg');
font-weight: normal;
@joecue
joecue / snippets.php
Last active February 4, 2016 13:11
Useful WordPress Snippets
//Remove Autolinking Comment Hyperlink
remove_filter('comment_text', 'make_clickable', 9);
//Require Minimum Comment Length
add_filter( 'preprocess_comment', 'minimal_comment_length' );
function minimal_comment_length( $commentdata ) {
$minimalCommentLength = 20;
if ( strlen( trim( $commentdata['comment_content'] ) ) < $minimalCommentLength ){