These instructions shall work on Mac OS X and Linux.
Installation via Homebrew:
brew install mkvtoolnix
<?php | |
/** | |
* Save the image on the server. | |
*/ | |
function save_image( $base64_img, $title ) { | |
// Upload dir. | |
$upload_dir = wp_upload_dir(); | |
$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR; |
<?php | |
function brrad_geocode($street_address,$city,$state){ | |
$street_address = str_replace(" ", "+", $street_address); //google doesn't like spaces in urls, but who does? | |
$city = str_replace(" ", "+", $city); | |
$state = str_replace(" ", "+", $state); | |
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=$street_address,+$city,+$state&sensor=false"; | |
$google_api_response = wp_remote_get( $url ); | |
These instructions shall work on Mac OS X and Linux.
Installation via Homebrew:
brew install mkvtoolnix
<?php | |
/*----------------------------------------- | |
REWRITE SEARCH URLS | |
-----------------------------------------*/ | |
// Redirect ?s=xxx to /search/xxx | |
function redirect_search_url() | |
{ | |
if (is_search() && !empty($_GET['s'])) { | |
wp_redirect(home_url('/' . _x('search' /* default search slug */, 'search url slug', THEME_TEXT_DOMAIN) . '/') . urlencode(get_query_var('s'))); |
/* | |
* Wrap all ACF Blocks in Disabled block to disable all links in edit view | |
*/ | |
const { createHigherOrderComponent } = wp.compose; | |
const { Fragment } = wp.element; | |
import { Disabled } from '@wordpress/components'; | |
const withDisabledCompontent = createHigherOrderComponent( ( BlockEdit ) => { | |
return ( props ) => { |
/** | |
* External Dependencies | |
*/ | |
import classnames from 'classnames'; | |
/** | |
* WordPress Dependencies | |
*/ | |
const { __ } = wp.i18n; | |
const { addFilter } = wp.hooks; |
<?php | |
/** | |
* Created by PhpStorm. | |
* User: Matteo | |
* Date: 04/07/2018 | |
* Time: 12:52 | |
*/ | |
/** | |
* Class ACFToArray |
/* | |
* Example adds certain named Product Attribute fields to the product Edit screen ready for completion. | |
* (Pre-requisite ) | |
* This saves the Shop Admin having to add them manually. | |
* | |
* Why might you want to do this instead of adding Custom fields? There's plenty of nice documentation on adding custom fields | |
* for example: http://www.remicorson.com/mastering-woocommerce-products-custom-fields/ | |
* | |
* Well a Product Attributes are a built in WooCommerce feature, using Terms which are a built in Wordpress feature. | |
* - no add-ons required |
<?php | |
/** | |
* Class Custom_WC_Email | |
*/ | |
class Custom_WC_Email { | |
/** | |
* Custom_WC_Email constructor. |
<form action="<?php echo site_url() ?>/wp-admin/admin-ajax.php" method="POST" id="filter"> | |
<?php | |
if( $terms = get_terms( 'category', 'orderby=name' ) ) : | |
echo '<select name="categoryfilter"><option>Select category...</option>'; | |
foreach ( $terms as $term ) : | |
echo '<option value="' . $term->term_id . '">' . $term->name . '</option>'; | |
endforeach; | |
echo '</select>'; | |
endif; |