Skip to content

Instantly share code, notes, and snippets.

View nicdford's full-sized avatar

Nic Ford nicdford

View GitHub Profile
@djrmom
djrmom / custom-hooks.php
Created February 8, 2018 14:54
facetwp index a field in a related post type
<?php
/**
** look up and index a value from a post relationship field
** set the datasource to the relationship field
** get the post id of that related post and use it to
** lookup its associated value
** for ACF you may want get_field() instead of get_post_meta()
** remember to do a full re-index after adding code
** check the wp_facetwp_index table if needed to see what values are being indexed
**/
@saltnpixels
saltnpixels / ajax_wp_query
Created April 10, 2016 13:15
ajax with wp_query
//put into functions
// AJAX receiver function
function get_my_ajax_stuff() {
// If there's a POST and a nonce set, verify the nonce to make sure this request is coming from the right place
if ( $_POST && isset( $_POST['nonce'] ) && wp_verify_nonce( $_POST['nonce'], 'my_nonce_action' ) ) {
// Initialize
$results = array();
// Do something here to get some data (sanitize user input as needed)
$articles = new WP_Query(array(
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@HoundstoothSTL
HoundstoothSTL / wp-download.sh
Created November 15, 2012 20:10
Download Wordpress through terminal and cleanup
#!/bin/bash
#Download the latest copy of WordPress into a directory, grab all the files in the new /wordpress folder
#Put all the files in the current directory, remove the now empty /wordpress directory
#Remove the tarball
#download latest wordpress with wget
wget http://wordpress.org/latest.tar.gz
#OR using CURL
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/