Skip to content

Instantly share code, notes, and snippets.

View mikejavier's full-sized avatar
🏠
Working from home

Michael Santillán mikejavier

🏠
Working from home
View GitHub Profile
@romuloctba
romuloctba / functions.php
Last active August 29, 2015 14:09
Add taxonomy images to WP-REST-API
<?php
//stuff...
function json_api_prepara_termo($data, $term, $context ) {
$termfield = get_field('arquivo_de_imagem', $term); //custom field inserido com plugin ACF
$data['customfields']['imagem'] = $termfield; //adiciona ele no array $data e o retorna
return $data;
}
add_filter( 'json_prepare_term', 'json_api_prepara_termo', 10, 3 );
@BFTrick
BFTrick / woocommerce-get-product-weight.php
Created June 24, 2013 22:28
You can get a products weight using this snippet. You will need to be in the product loop to access it or on a page like content-single-product.php where you're already within the loop.
global $product;
$attributes = $product->get_attributes();
if ( $product->has_weight() ) {
echo $product->get_weight();
}
/* ----------------------------------------------------------------------------------------------------
Super Form Reset
A couple of things to watch out for:
- IE8: If a text input doesn't have padding on all sides or none the text won't be centered.
- The default border sizes on text inputs in all UAs seem to be slightly different. You're better off using custom borders.
- You NEED to set the font-size and family on all form elements
- Search inputs need to have their appearance reset and the box-sizing set to content-box to match other UAs