Skip to content

Instantly share code, notes, and snippets.

View ahaywood's full-sized avatar

Amy Haywood Dutton ahaywood

View GitHub Profile
@ahaywood
ahaywood / component.vue
Created November 30, 2015 16:54
JS: vue.js - vueify template
<style lang="sass">
</style>
<template>
</template>
@ahaywood
ahaywood / Gulpfile.js
Last active November 2, 2017 18:51
Gulpfile.js
var gulp = require('gulp'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps'),
prefix = require('gulp-autoprefixer'),
cleanCSS = require('gulp-clean-css'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant'),
watch = require('gulp-watch'),
<?php
define('DB_NAME', '');
define('DB_USER', '');
define('DB_PASSWORD', '');
define('DB_HOST', '' );
$table_prefix = 'wp_';
@ahaywood
ahaywood / sidebar.php
Created June 5, 2015 21:43
PHP: WP - Recent Comments
<?php $comments = get_comments('status=approve&number=3'); ?>
<?php foreach ($comments as $comment) { ?>
<?php $title = get_the_title($comment->comment_post_ID); ?>
<div class="recent-comment">
<a href="<?php echo get_permalink($comment->comment_post_ID); ?>" rel="external nofollow" title="<?php echo $title; ?>">
<div class="recent-comment__count"><?php $comment_count = wp_count_comments( $comment->comment_post_ID ); echo $comment_count->approved; ?></div>
<div class="comment_meta">
<div class="recent-comment__text">
<?php // echo $title; ?>
<?php echo wp_html_excerpt( $comment->comment_content, 150 ); ?>
@ahaywood
ahaywood / footer.php
Created June 5, 2015 21:41
PHP: WP - Categories
@ahaywood
ahaywood / footer.php
Created June 5, 2015 21:40
PHP: WP - Tags
@ahaywood
ahaywood / app.js
Created June 5, 2015 21:38
PHP: WP - Expanding and collapsing archives
/* handle archives expanding / collapsing within the footer */
function initFooterArchives() {
hideArchiveMonths(); // Hide all the archive months to begin with
// Set up archive year click
$('.js-footer__archives__year').find('a').click(function(e) {
e.preventDefault();
var $parent = $(this).parent();
@ahaywood
ahaywood / acf-options-functions.php
Created March 12, 2015 03:39
PHP: WP - Add an ACF Options Page
/*------------------------------------*\
Create an ACF Options Page
http://www.advancedcustomfields.com/resources/options-page/
\*------------------------------------*/
/*
if( function_exists('acf_add_options_page') ) {
acf_add_options_page();
}
*/
<?php
//This is a filter to change the default validation message that Gravity Forms generates
add_filter('gform_validation_message', 'change_validation_message', 10, 2);
function change_validation_message($message, $form)
{
return "<div class='validation_error'><strong>Oops!</strong> Looks like there’s something wrong. Please review the form above.</div>";
}
// Often forms in Gravity Forms to need to start with default values and we need to check the form in case the user hasn't entered new data and give them a validation message back
@ahaywood
ahaywood / .gitignore
Created February 16, 2015 06:08
.gitignore for a Wordpress Project
# As Yeoman assumes the usage of Bower and Grunt, ignore the below:
bower_components
node_modules
# Ignore automatically generated cruft
*.log
.sass-cache
# Ignore config
local-config.php