Skip to content

Instantly share code, notes, and snippets.

@chrisguitarguy
chrisguitarguy / object-cache.php
Created October 29, 2012 00:40
WordPress object cache implementation using APC.
<?php
/**
* Plugin Name: APC Object Cache
* Description: An object cache implementation that uses APC.
* Author: Christopher Davis
* Author URI: http://christopherdavis.me
* Version: 0.1
*
* Based on Mark Jaquith's APC object cache
* http://txfx.net/wordpress-plugins/apc/
@johnbillion
johnbillion / gist:5225514
Last active May 29, 2019 12:56
Post Meta Revisions
<?php
/*
Plugin Name: Post Meta Revisions
Description: Revisions for the 'foo' post meta field
Version: 1.0
Author: John Blackbourn
Plugin URI: http://lud.icro.us/post-meta-revisions-wordpress
*/
@manishsongirkar
manishsongirkar / Gruntfile.js
Created August 24, 2015 07:09
Grunt Settings
'use strict';
module.exports = function(grunt) {
// load all grunt tasks matching the `grunt-*` pattern
// Ref. https://npmjs.org/package/load-grunt-tasks
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// Fontello Icons
// Note: This is one time running task, so run grunt after update assets/fontello/config.json file
// Ref. https://npmjs.org/package/grunt-fontello
fontello: {
@gokulkrishh
gokulkrishh / media-query.css
Last active November 10, 2024 02:00
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@pradeepdotco
pradeepdotco / disable-wordpress-search.php
Created November 9, 2015 22:12
Disable WordPress Search
function fb_filter_query( $query, $error = true ) {
if ( is_search() ) {
$query->is_search = false;
$query->query_vars[s] = false;
$query->query[s] = false;
// to error
if ( $error == true )
$query->is_404 = true;
@danielbachhuber
danielbachhuber / import-cache.php
Created March 31, 2016 18:27
During `wp import`, cache remote files locally for subsequent imports
<?php
/**
* Run with `wp --require=import-cache.php import ...
*/
WP_CLI::add_hook( 'after_wp_load', function(){
// Only intercept HTTP requests when the importer is running
if ( ! defined( 'WP_IMPORTING') || ! WP_IMPORTING ) {
return;
@PatelUtkarsh
PatelUtkarsh / ee-vip-go-local.sh
Created May 11, 2016 05:54
Setup vip-go in local environment for site which are already created with easyengine.
#!bin/bash
#
# NOTE:This file takes param as site name for
#
# This script currenty only works with easyengine.
#
# What this does essentially is clones mu-plugin repo of vip-mu-plugins-public
# and write nginx rule to handle static files via php.
#
# WARNING: This does not match extact vip go environment like php version and stuff
<?php
/**
* Class Customize_Postmeta_Setting.
*
* @package WPSE_257322
*/
namespace WPSE_257322;
/**
@ahmadawais
ahmadawais / upload-a-file.MD
Created June 18, 2017 11:07 — forked from websupporter/upload-a-file.MD
Upload a file using the WordPress REST API

Upload files

Using the REST API to upload a file to WordPress is quite simple. All you need is to send the file in a POST-Request to the wp/v2/media route.

There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle: