Skip to content

Instantly share code, notes, and snippets.

View kellenmace's full-sized avatar

Kellen Mace kellenmace

View GitHub Profile
@kellenmace
kellenmace / functions.php
Created March 10, 2015 16:20
trivium enqueue scripts
function trivium_enqueue_scripts() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() .'/style.css' );
// Use is_page_template() conditional so this only loads on page-results.php and single-event.php
wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false' );
wp_enqueue_script( 'trivium-scripts', get_stylesheet_directory_uri() .'/js/trivium-scripts.js', array( 'jquery', 'google-maps' ) );
// jQuery DataTables scripts & styles for Results
if ( is_page( 'Results' ) || is_page( 'Event List' ) ) {
wp_enqueue_style( 'datatables-css', '//cdn.datatables.net/1.10.4/css/jquery.dataTables.css' );
@kellenmace
kellenmace / trivium-scripts.js
Created March 10, 2015 16:23
trivium racing js
$(document).ready(function(){
// Render ACF Google Map
$('.acf-map').each(function(){
render_map( $(this) );
});
// Set up jQuery DataTables
if ( $( '#event-results' ).dataTable || $( '#event-list-container' ).dataTable ) {
@kellenmace
kellenmace / template-tags.php
Created March 10, 2015 16:40
localize call
function trivium_build_calendar_events() {
$events_query = new WP_Query( array(
'post_type' => 'event',
'order' => 'ASC'
) );
if ( $events_query->have_posts() ) {
$calendar_events = array();
elseif ( is_admin() ) {
/**
* Include plugin options page
* @since 1.0
*/
include_once( plugin_dir_path( __FILE__ ) . 'includes/admin.php' );
/**
* Include Custom Metaboxes and Fields Library
* @since 1.2
@kellenmace
kellenmace / Force CSS Changes to “go live" Immediately
Created April 8, 2015 13:33
Force CSS Changes to “go live” Immediately
wp_enqueue_style( 'stylesheet-name', get_stylesheet_directory_uri() . '/style.css' . '?' . filemtime( get_stylesheet_directory() . '/style.css' ), );
@kellenmace
kellenmace / Force CSS Changes to “go live” Immediately
Created April 8, 2015 13:59
Force CSS Changes to “go live” Immediately
wp_enqueue_style( 'stylesheet-name', get_stylesheet_directory_uri() . '/style.css' . '?' . filemtime( get_stylesheet_directory() . '/style.css' ) );
Getting started on an existing project:
boot up vvv
get database dump file from DevOps engineer - Jason DeWitt
use site wizard to create a new site using this flag:
-db followed by the local database file to import (or import via Sequel Pro later on)
clone the repo into the appropriate directory
if you want to download the media from the live site, add this code to the site’s vvv config file (vvv-local > config > nginx-config > sites > nameoflocalsite.conf):
---------------------------------------
Directives to send expires headers and turn off 404 error logging.
@kellenmace
kellenmace / appfoliowebsite
Created May 28, 2015 14:21
appfoliowebsite
appfoliowebsite.dev
supertest.appfoliowebsite.dev
statestreet_blueandtan.appfoliowebsite.dev
demo-statestreet-sfr1.appfoliowebsite.dev
demo-statestreet-mfr2.appfoliowebsite.dev
demo-statestreet-mfr1.appfoliowebsite.dev
oceanblueproperties.appfoliowebsite.dev
cityproperties.appfoliowebsite.dev
demo-statestreet-com1.appfoliowebsite.dev
demo-altavista-sfr3.appfoliowebsite.dev
@kellenmace
kellenmace / wp-config.php
Created May 28, 2015 14:45
appfioliowebsite
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
<?php
namespace IOCDF;
/**
* Rewrite post URLs that have a /news/%postname%/ structure
*/
function rewrite_post_urls() {
add_rewrite_rule('^blog/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/?', 'index.php?/blog/year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&postname=$matches[4]', 'top');