This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var script, | |
scripts = document.getElementsByTagName('script')[0]; | |
function load(url) { | |
script = document.createElement('script'); | |
script.async = true; | |
script.src = url; | |
scripts.parentNode.insertBefore(script, scripts); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $attachments = new Attachments( 'attachments' ); ?> | |
<?php if( $attachments->exist() ) : ?> | |
<h3>Attachments</h3> | |
<ul> | |
<?php while( $attachments->get() ) : ?> | |
<li> | |
ID: <?php echo $attachments->id(); ?><br /> | |
Type: <?php echo $attachments->type(); ?><br /> | |
Subtype: <?php echo $attachments->subtype(); ?><br /> | |
URL: <?php echo $attachments->url(); ?><br /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_attachments( $attachments ) | |
{ | |
$args = array( | |
// title of the meta box (string) | |
'label' => 'My Attachments', | |
// all post types to utilize (string|array) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function is_blog () { | |
global $post; | |
$posttype = get_post_type($post ); | |
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ; | |
} | |
Usage: | |
<?php if (is_blog()) { echo 'You are on a blog page'; } ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## v1.0.6 | |
## this script will gernerate css stats | |
### example output | |
# CSS STATS | |
# ---------- | |
# Floats: 132 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Display Fields | |
add_action( 'woocommerce_product_after_variable_attributes', 'my_variable_fields', 10, 2 ); | |
//JS to add fields for new variations | |
add_action( 'woocommerce_product_after_variable_attributes_js', 'my_variable_fields_js' ); | |
//Save variation fields | |
add_action( 'woocommerce_process_product_meta_variable', 'my_save_variable_fields', 10, 1 ); | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Delete all revisions from all posts in either a network or a single blog. | |
// Quick hack by @mrazzari, 2014. | |
// For context see this thread started by Kitchin at the forums: | |
// http://wordpress.org/support/topic/deleting-post-revisions-do-not-use-the-abc-join-code-you-see-everywhere | |
// HOWTO | |
// This snippet is meant to be called as a standalone script. | |
// Like http://example.com/tmp/multisite_delete_revisions.php |