Skip to content

Instantly share code, notes, and snippets.

View theperfectwill's full-sized avatar
💭
Coding... Working on The WPOnion Framework with Varun

The Perfect Will theperfectwill

💭
Coding... Working on The WPOnion Framework with Varun
View GitHub Profile
@theperfectwill
theperfectwill / file-tree-fix.md
Created April 29, 2016 20:46
Cloud9IDE File Tree is Broken, Support Help please!

If you're File Tree pan is not showing for some reason or perhaps because you tried to make you "FILE SYSTEM" folder a "FAVORITE" then this is how to fix it.

(I left this here in case someone else runs into this issue, or Cloud9IDE can reduplicate this issue and create a preventive solution from another use encountering this.)


In short here is how...

I found that when I refresh the page the File Tree will appear again, for a brief moment but then disappear again. The brief moment this appears is just enough time to right click on the "!fsroot" folder and it's "~" folder to click "Remove from Favorites", which will remove those folders from the Favorites list. After doing that the File Tree may still disappear, but after refreshing, things should be back to normal.

@theperfectwill
theperfectwill / index.php
Created May 23, 2016 19:01 — forked from xeoncross/index.php
Benchmarking Wordpress
<?php
// Debug performace
define('START_TIME', microtime(TRUE));
define('START_MEMORY', memory_get_usage());
define('B_FILENAME', '/tmp/wordpress.debug.txt');
file_put_contents(B_FILENAME, '', LOCK_EX);
$starting_classes_ = get_declared_classes();
@theperfectwill
theperfectwill / custom-register-fields.php
Created June 7, 2016 00:29 — forked from lukecav/custom-register-fields.php
Custom Registered FIelds Plugin
<?php
/*
Plugin Name: Custom Register Fields
Plugin URI: http://www.lcavanagh.bluehoststaff.com/
Description: Add first name, last name and job title.
Author: Luke Cavanagh
Version: 1.0
Author URI: http://www.lcavanagh.bluehoststaff.com/
GNU General Public License, Free Software Foundation <http://creativecommons.org/licenses/GPL/2.0/>
*/
@theperfectwill
theperfectwill / sm-annotated.html
Created June 10, 2016 06:13 — forked from hdragomir/sm-annotated.html
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@theperfectwill
theperfectwill / more-recent-product.php
Created July 26, 2016 23:59 — forked from corsonr/more-recent-product.php
WooCommerce: display more recent version of a product notice
<?php
// Display Fields
add_action( 'woocommerce_product_options_related', 'woo_add_custom_fields' );
// Save Fields
add_action( 'woocommerce_process_product_meta', 'woo_add_custom_fields_save' );
// Display notice on proeuct page
add_action( 'woocommerce_single_product_summary', 'woo_display_more_recent_product_notice', 10 );
@theperfectwill
theperfectwill / gist:caf5cf899b748bfaef9ca79f6e6746d8
Created July 26, 2016 23:59 — forked from corsonr/gist:5933479
List WooCommerce products by tags
<?php
/**
* Plugin Name: WooCommerce - List Products by Tags
* Plugin URI: http://www.remicorson.com/list-woocommerce-products-by-tags/
* Description: List WooCommerce products by tags using a shortcode, ex: [woo_products_by_tags tags="shoes,socks"]
* Version: 1.0
* Author: Remi Corson
* Author URI: http://remicorson.com
* Requires at least: 3.5
* Tested up to: 3.5
@theperfectwill
theperfectwill / php-html-css-js-minifier.php
Created August 6, 2016 22:58 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* ----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/engine/plug/converter.php`
* ----------------------------------------------------------------------------------------
*/
//* Link e4gf_events CPT to categories taxonomy
add_action( 'init', 'sk_add_category_taxonomy_to_events' );
function sk_add_category_taxonomy_to_events() {
register_taxonomy_for_object_type( 'category', 'e4gf_events' );
}
@theperfectwill
theperfectwill / gist:eb56696f6d0e1bf1766ed9c93f70be4e
Created August 17, 2016 03:30 — forked from johnkolbert/gist:769160
Unregisters a post type and removes the menu item
<?php
/*
* Usage for a custom post type named 'movies':
* unregister_post_type( 'movies' );
*
* Usage for the built in 'post' post type:
* unregister_post_type( 'post', 'edit.php' );
*/
function unregister_post_type( $post_type, $slug = '' ){
@theperfectwill
theperfectwill / wp-get_id_by_slug
Created September 6, 2016 11:48 — forked from davidpaulsson/wp-get_id_by_slug
WordPress: Get page ID from slug
// Usage:
// get_id_by_slug('any-page-slug');
function get_id_by_slug($page_slug) {
$page = get_page_by_path($page_slug);
if ($page) {
return $page->ID;
} else {
return null;
}