Skip to content

Instantly share code, notes, and snippets.

@musicalbigfoot
musicalbigfoot / gist:f52dc92f52a6211aa022
Created April 9, 2015 04:05
ACF: Update sort order of repeater fields - functions/php
add_action('wp_ajax_library_set_update_sort', 'library_set_update_sort');
add_action('wp_ajax_nopriv_library_set_update_sort', 'library_set_update_sort');
function library_set_update_sort() {
$return = array();
$order = array();
$new_order = $_POST['new_order'];
foreach ($new_order as $i => $row) {
$row = split('-', $row);
$my_library_id = $row[0];
@musicalbigfoot
musicalbigfoot / gist:bf0e089eed7423672132
Created April 10, 2015 17:20
Javascript: Style console.log message
console.log('%c Console Style', 'color: #be226e; font-size: 24px;');
@musicalbigfoot
musicalbigfoot / gist:7ec04f6c3eb12c8a029b
Created May 27, 2015 20:32
clearfix shortcode - wordpress functions
function clearfix_shortcode( $atts, $content = null ) {
extract( shortcode_atts(
array(
'' => '',
), $atts )
);
$result = '<div class="clear"></div>';
return $result;
@musicalbigfoot
musicalbigfoot / gist:6ce386ae68da98d26088
Created June 10, 2015 21:47
Wordpress ACF Pro Options Page
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Fiera Woocommerce Settings',
'menu_title' => 'Fiera Woo',
'menu_slug' => 'fiera-woocommerce-settings',
'capability' => 'edit_posts',
'position' => 62,
'icon_url' => 'dashicons-cart',
));
@musicalbigfoot
musicalbigfoot / gist:ce8d86175e05cdf5fb7e
Created June 21, 2015 16:12
Wordpress Woocommerce Product Archive
<?php
$args = array(
'post_type' => 'product',
'meta_key' => '_featured',
'meta_value' => 'no',
'posts_per_page' => -1,
'order' => 'asc',
);
$products = array();
$products_query = new WP_Query( $args );
@musicalbigfoot
musicalbigfoot / functions.php
Created July 10, 2015 15:18
Woocommerce: Show variable product price when all prices are the same
// Display Price For Variable Product With Same Variations Prices
add_filter('woocommerce_available_variation', function ($value, $object = null, $variation = null) {
if ($value['price_html'] == '') {
$value['price_html'] = '<span class="price">' . $variation->get_price_html() . '</span>';
}
return $value;
}, 10, 3);
@musicalbigfoot
musicalbigfoot / gist:4424517
Created January 1, 2013 01:19
HTML: Starting Template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1>Test Update</h1>
@musicalbigfoot
musicalbigfoot / gist:4428947
Last active December 10, 2015 11:38
JavaScript: jQuery .post to ajax controller
var postdata = {varname:varvalue};
$.post("/ajax/", postdata, function(data) {
console.log(data);
return false;
},'json');
@musicalbigfoot
musicalbigfoot / gist:4496049
Created January 9, 2013 19:26
Foundation: Button Group
<ul class="button-group two-up radius">
<li><a href="#" class="button radius">Button 1</a></li>
<li><a href="#" class="button radius">Button 2</a></li>
</ul>
@musicalbigfoot
musicalbigfoot / gist:4577366
Created January 20, 2013 08:56
CSS: Transition All
-webkit-transition: all .5s ease-in-out;
-moz-transition: all .5s ease-in-out;
-ms-transition: all .5s ease-in-out;
-o-transition: all .5s ease-in-out;
transition: all .5s ease-in-out;