Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Plugin Name: Envira CDN Fix
* Plugin URI: https://logoscreative.com
* Description: Support images on a CDN with Envira
* Version: 1.0
* Author: Logos Creative
* Author URI: https://logoscreative.com
*/
@logoscreative
logoscreative / tec-genesis-handshake.php
Created October 6, 2015 10:17
Genesis + ECP Handshake
<?php
/**
* Genesis + ECP Handshake
*
* Integrates the things from: https://theeventscalendar.com/knowledgebase/genesis-theme-framework-integration/
*
* @package genesis_ecp_handshake
* @author Cliff Seal <[email protected]>
* @link http://evermo.re
* @copyright 2015 Logos Creative
@logoscreative
logoscreative / plugin.php
Created October 5, 2015 18:03
Override DPP Encoding
/**
* NOTE: Unencode > in DPP Freeform CSS
*
* @since 1.0.9
*/
function evermore_unencode_dpp_css( $safe_text, $text ) {
if ( strpos( $safe_text, 'gt;' ) !== false && strpos( $safe_text, 'lt;' ) === false ) {
$safe_text = $text;
@logoscreative
logoscreative / plugin.php
Created September 20, 2015 21:58
Batch Set External Images in Content as Featured Images
<?php
/**
* Batch Set External Images in Content as Featured Images
*
* Look for external images shoved into the content, upload them to the Media Library, and assign it as the featured post.
*
* @package batch_upload_featured
* @author Cliff Seal <[email protected]>
* @link http://evermo.re
* @copyright 2015 Logos Creative
@logoscreative
logoscreative / functions.php
Created June 23, 2015 19:01
Pods meta_value_num PoC
<?php
/**
* WordPress stores all meta fields as strings, which causes problems for ordering by numbers. When using Pods::find() directly, this issue can be addressed by casting the field as a decimal, as shown here: https://github.com/pods-framework/pods-code-library/blob/master/example/classes/Pods/find/examples/orderby-number.php
*
* In shortcodes, this strategy is not possible, as MySQL functions can not be used in the WordPress post editor. Instead, you can use the "pods_shortcode_findrecords_params" params filter, as shown below:
*/
/**
* Example to order by a price field properly.
*/
@logoscreative
logoscreative / bcp.json
Last active August 29, 2015 14:18
The Daily Office Readings from the Book of Common Prayer in a single JSON object
{
"1":{
"psalm-1":"Ps. 103",
"psalm-2":"Ps. 148",
"ot":"Isa. 62:1-5,10-12",
"nt":"Rev. 19:11-16",
"gospel":"Matt. 1:18-25"
},
"2":{
"psalm-1":"Ps. 34",
@logoscreative
logoscreative / plugin.php
Last active February 1, 2023 12:14
Friendlier, Safer WordPress Admin Areas
<?php
/**
* "Friendlier, Safer WordPress Admin Areas"
* Presented by Cliff Seal at WordCamp Atlanta 2015 and Asheville 2016
* Slides: http://www.slideshare.net/cliffseal/wp-admin
*
* Plugin Name: A Better Admin Experience
* Plugin URI: http://evermoresites.com
* Description: Cleans up and sanitizes the WordPress admin area
* Version: 1.0
@logoscreative
logoscreative / functions.php
Created January 24, 2015 19:05
Hook Gravity Forms Submission Into Events Calendar Pro
/* Make Events Form Work Redux */
add_filter("gform_post_data", "mb_set_post_date", 10, 3);
function mb_set_post_date($post_data, $form, $entry){
if($form["id"] != 48)
return $post_data;
$startdate = $entry["69"];
$starttime = $entry["5"];
<?php
/**
* Finds the the full filepath for /wp-load.php in a ancestor directory.
*
* Walks up the parent directory stack to locate wp-load.php.
* Used by files in plugins that need require() wp-load.php
* but that might not be stored exactly where expected.
*
* Works as long as the wp-load.php is found by traversing parent directories.
*
@logoscreative
logoscreative / events-calendar-pro.php
Last active August 29, 2015 14:10
Redirecting to Next Recurring Event Instance
if( !empty($get_recurrence_event->posts) && tribe_is_recurring_event($get_recurrence_event->posts[0]->ID) && get_post_status($get_recurrence_event->posts[0]) == 'publish' ){
$nextevent = '';
$now = strtotime('now');
foreach ( tribe_get_recurrence_start_dates($event->ID) as $eventinstance ) {
$upcoming = strtotime($eventinstance);
if ( $now < $upcoming ) {
$eventinstance = explode(" ", $eventinstance);
$nextevent = $eventinstance[0];
break;
}