Skip to content

Instantly share code, notes, and snippets.

View ahaywood's full-sized avatar

Amy Haywood Dutton ahaywood

View GitHub Profile
@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 / footer.php
Created June 5, 2015 21:40
PHP: WP - Tags
@ahaywood
ahaywood / footer.php
Created June 5, 2015 21:41
PHP: WP - Categories
@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 ); ?>
<?php
define('DB_NAME', '');
define('DB_USER', '');
define('DB_PASSWORD', '');
define('DB_HOST', '' );
$table_prefix = 'wp_';
@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'),
@ahaywood
ahaywood / component.vue
Created November 30, 2015 16:54
JS: vue.js - vueify template
<style lang="sass">
</style>
<template>
</template>
@ahaywood
ahaywood / wp-config.php
Created December 1, 2015 21:20
PHP: WP - Prevent Automatic Updates
/**
* Prevent Wordpress from automatically updating
*/
define( 'AUTOMATIC_UPDATER_DISABLED', true );
@ahaywood
ahaywood / functions.php
Created February 9, 2016 21:27
PHP: WP - Register Custom Taxonomy
register_taxonomy(
'type_of_staff', // Taxonomy
'staff', // Object Type
array(
'label' => __( 'Type' ),
'rewrite' => array( 'slug' => 'type' ),
'hierarchical' => true, // Is this taxonomy hierarchical like categories or not hierarchical like tags.
)
);
@ahaywood
ahaywood / wp-config.php
Last active May 29, 2018 01:40
PHP: WP - Config file for working with local-config.php
<?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