Skip to content

Instantly share code, notes, and snippets.

View NateJLewis's full-sized avatar
🎯
Focusing

Nate Lewis NateJLewis

🎯
Focusing
View GitHub Profile
@neilgee
neilgee / scrollreveal.php
Last active August 29, 2015 14:08
ScrollReveal.js in Genesis
<?php
//do not add in opening php tag
/**
* Add in ScrollReveal.js in a Genesis Theme
*
* @package Add in ScrollReveal.js in a Genesis Theme
* @author Neil Gee
* @link http://wpbeaches.com/using-scrollreveal-js-wordpress-genesis-theme/
@neilgee
neilgee / mod-primary-nav.php
Last active December 4, 2015 07:28
Reposition Genesis Primary Navigation to Header Right Widget and Remove Structural Wrap
<?php
//do not copy the opening php tag above
/**
* Swap Primary Nav to Header Right and Remove Wrap
*
* @package Swap Primary Nav
* @author Neil Gee
* @link http://coolestguidesontheplanet.com/switching-primary-menu-genesis-theme-header-right/
* @copyright (c) 2014, Neil Gee
<?php
/**
* Abstract class for making API routes
*
* @package @todo
* @author Josh Pollock <Josh@JoshPress.net>
* @license GPL-2.0+
* @link
* @copyright 2015 Josh Pollock
*/
@neilgee
neilgee / _s_custom.header.php
Last active May 13, 2016 10:10
Custom Headers
<?php //<~ don't add me
<?php if ( get_header_image() ) : ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<img src="<?php header_image(); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="">
</a>
<?php endif; // End header image check. ?>
@dmitry-korolev
dmitry-korolev / get_excerpt_by_id.php
Created September 22, 2015 17:19
Get excerpt by id in Wordpress.
<?php
if (!function_exists(get_excerpt_by_id)) {
/**
* Returns excerpt by ID. WP_Post->post_excerpt if it presents, wp_trim_words on other case.
* @param mixed $post WP_Post object or post ID. Accepts WP_Post object or post ID (integer or string);
* @return string Excerpt
*/
function get_excerpt_by_id($post) {
$return_excerpt = function($post) {
if ($post->post_excerpt == '')
@tommcfarlin
tommcfarlin / ajax-reg.js
Last active August 26, 2017 14:08 — forked from csknk/ajax-reg.js
/**
* This file is enqueued by means of wp_enqueue_script() - variables are passed
* in from PHP by means of wp_localize_script()
*
*/
/* TM: We use an anonymous function to invoke the JavaScript. Also refactored for proper
* WordPress coding standards.
*/
(function( $ ) {
@briancray
briancray / linkify.js
Created November 6, 2012 13:56
Linkify Twitter API entities
/*
Compliant with Twitter's Developer Display Requirements:
https://dev.twitter.com/terms/display-requirements
*/
var linkify_result = function (tweet /* tweet object from the results array */) {
var subs = [],
last_offset = 0,
new_tweet = '',
entity,
replace = {
@sonnyt
sonnyt / gist:8585696
Last active June 15, 2018 12:45
JavaScript Check If Element Has Class
function hasClass(element, className) {
return element.className && new RegExp("(^|\\s)" + className + "(\\s|$)").test(element.className);
}
var myDiv = document.getElementById('MyDiv');
hasClass(myDiv, 'active');
// OR
@vladikoff
vladikoff / resource.js
Created April 17, 2014 17:52
Angular $resource and transformResponse
angular.module('itemServices', ['ngResource'])
.factory('Item', ['$resource',
function ($resource) {
return $resource('items/:id',
{id: '@id'},
{
query: {
isArray: true,
method: 'GET',
params: {},
@Shelob9
Shelob9 / ships.php
Last active April 4, 2020 21:25
Example code for my Pods Screencast: Using Pods Pages With Advanced Content Types -- http://youtu.be/iUDPYid0bUU
<?php
/**
* Template Name: Ships
*/
get_header(); ?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">