Skip to content

Instantly share code, notes, and snippets.

View mattradford's full-sized avatar
👋

Matt Radford mattradford

👋
View GitHub Profile
@tjstein
tjstein / nginx-vhost.conf
Created April 5, 2011 00:47
nginx vhost config for WordPress + PHP-FPM
upstream php-fpm {
server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
server_name www.example.com;
rewrite ^ http://example.com$request_uri?;
}
@WebEndevSnippets
WebEndevSnippets / header.php
Created January 21, 2013 18:02
WordPress: Custom Loop with WP_Query and Transient
function shireman_books_header_loop( $args ) {
global $post;
$defaults = array(
'orderby' => 'rand',
'post_type' => 'we_published-book',
'posts_per_page' => 9,
'post_status' => 'publish',
'no_found_rows' => true, // counts posts, remove if pagination required
'update_post_term_cache' => false, // grabs terms, remove if terms required (category, tag...)
'update_post_meta_cache' => false, // grabs post meta, remove if post meta required
@Rarst
Rarst / composer.json
Last active January 27, 2023 12:40
Test project for WordPress stack via Composer
{
"name" : "rarst/install-test",
"description" : "Test project for WordPress stack via Composer",
"authors" : [
{
"name" : "Andrey Savchenko",
"homepage": "http://www.Rarst.net/"
}
],
"type" : "project",
@tomvdv
tomvdv / codekit2_lazy-commit.sh
Last active July 27, 2016 20:18
CodeKit 2 hook: auto-commit changes to local git repo
# terminal-notifier available at https://github.com/alloy/terminal-notifier
PROJECT_PATH="/Users/username/Path/To/Project/"
GITFILE="$PROJECT_PATH.git"
if [ ! -e $GITFILE ]
then
cd $PROJECT_PATH && git init && git add . && git commit -m 'initial commit'
terminal-notifier -message "Created local git repo with initial commit" -title "CodeKit hook: git"
else
@spivurno
spivurno / gw-gp-limit-choices-shortcodes.php
Created March 27, 2014 23:38
Gravity Wiz // Gravity Perks // GP Limit Choices // Shortcodes
<?php
/**
* Gravity Wiz // Gravity Perks // GP Limit Choices // Shortcodes
*
* Provides several shortcodes providing the ability to display the number of times a choice has been selected,
* the total number of times a choice can be selected, and the remaining number of times a choice can be selected.
*
* @version 1.0
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
@mapsam
mapsam / README.md
Created April 25, 2014 00:37
Inline SVG partial for WordPress

Good for acting on specific pieces of your SVG object instead of just link as an <img> you can bring the entire object into your HTML. You need two things:

  1. SVG file with a double extension ending with .php - e.g. logo.svg.php
  2. WP include statement with the built-in function get_template_part
<?php
get_template_part( 'includes/partials/logo', 'logo.svg' );
?>
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@danielbachhuber
danielbachhuber / cache-purge.php
Created February 22, 2016 17:34
Trigger Varnish cache purge on deploy to WP Engine
<?php
add_action( 'init', function(){
// Replace '901bcc678021c0e12f1583085cafda1d' with a secret of your own.
if ( ! empty( $_GET['purge-cache'] ) && '901bcc678021c0e12f1583085cafda1d' === $_GET['purge-cache'] ) {
WpeCommon::purge_varnish_cache_all();
echo 'Cache purged';
exit;
}
});
@lukecav
lukecav / gist:4224fbb2a57383e3cc511f136697ef58
Last active June 30, 2020 08:23
gravity-forms-list-field-datepicker-plugin.php
<?php
/*
Plugin Name: Date Picker in List Fields for Gravity Forms
Description: Gives the option of adding a date picker to a list field column
Version: 1.6.2
Author: Adrian Gordon
Author URI: http://www.itsupportguides.com
License: GPL2
Text Domain: gravity-forms-list-field-date-picker
@felixarntz
felixarntz / wp-alignment-classes.css
Created November 24, 2017 15:52
New WordPress alignment classes introduced by Gutenberg
/* -------------------------------------------------------------
# Variables
------------------------------------------------------------- */
$site_maxwidth: 72rem; // Maximum width the entire site should not exceed
$site_maxwidth-text: 40rem; // Maximum width the main content text should not exceed
$spacing_horizontal: 1rem; // General horizontal padding
/* -------------------------------------------------------------
# General Styles