Skip to content

Instantly share code, notes, and snippets.

/**
* Replace image urls with newly uploaded images.
*
* @since 1.0.0
*
* @param array $images Array of new images uploaded.
* @param array $data Array of for which images url needs to be replaced.
*/
private function replace_images_urls( $images, $data ) {
$data = wp_json_encode( $data );
@cleverness
cleverness / post-planner-dashboard-widget.class.php
Created February 14, 2016 20:56
Add category to dashboard widget.
<?php
/**
* Post Planner Plugin Dashboard Widget
*
* Creates the dashboard widget
* @author C.M. Kendrick <cindy@seaserpentstudio.com>
* @package post-planner
* @version 1.5
*/
@cleverness
cleverness / post-planner-mods.php
Created February 14, 2016 20:54
Add category to dashboard widget
<?php
/*
Plugin Name: Post Planner Mods
Version: 1.0
Description: Post Planner Plugin Modifications
Author: C.M. Kendrick
Author URI: http://seaserpentstudio.com
Plugin URI: http://seaserpentstudio.com/post-planner
*/
/*
* grunt-phpdocumentor
* https://github.com/gomoob/grunt-phpdocumentor
*
* Copyright (c) 2013 Baptiste Gaillard
* Licensed under the MIT license.
*/
'use strict';
/**
* Insert new to-do item into the database
* @static
* @return mixed
*/
public static function insert_todo() {
global $current_user;
if ( $_POST['cleverness_todo_description'] == '' ) return;
@cleverness
cleverness / 0_reuse_code.js
Created September 25, 2015 18:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
/**
*
* The Sendmail script allows DesktopServer to route low-level email to a file in
* a self purging folder that cleans up itself after 48 hours.
*
* @package DesktopServer
* @since 3.8.0
*/
@cleverness
cleverness / cleverness-to-do-list-frontend.class.php
Created September 15, 2015 14:27
Don't allow non-logged in viewers to see [todolist]
<?php
/**
* Cleverness To-Do List Plugin Frontend Classes
*
* Allows administration and viewing of to-do items on front-end
* @author C.M. Kendrick <cindy@cleverness.org>
* @package cleverness-to-do-list
* @version 3.2.2
*/
@cleverness
cleverness / class-wp-cli.php
Created September 2, 2015 17:51
Create guest authors from post meta
/**
* Create guest authors from meta
*
* Comment out is_object in co-authors-plus.php get_coauthor_by
*
* @since 1.0.0
*
* @subcommand create-guests-from-meta
*
* @param $args
@cleverness
cleverness / gist:ad511b629810e138f80a
Created August 6, 2015 17:55
VIP WP_CLI alternative to no limit
$posts_per_page = 100;
$page = 1;
do {
$posts = get_posts( array(
'posts_per_page' => $posts_per_page,
'paged' => $page,
));
// Do stuff