Skip to content

Instantly share code, notes, and snippets.

View alanef's full-sized avatar

Alan Fuller alanef

View GitHub Profile
@alanef
alanef / functions.php
Last active December 30, 2021 14:10
Filter Event By Title
<?php
//* Do NOT include the opening php tag shown above if adding to functions.php.
//* the following example changes individual event colours
//* based on what the title matches
//* see full list of options here https://fullcalendar.io/docs/v3/event-object
add_filter( 'wfea_cal_event_extra_options', function ( $options ) {
if ( preg_match( '/Monday/', $options['title'] ) ) {
$options['color'] = '#000';
var date = Utilities.formatDate(new Date(), "GMT", "EEE, dd MMM yyyy HH:mm:ss Z");
var secret = xxxxxx;
var public_key = yyyyyyyyyy;
var developer_id = 'xxxx';
var plugin_id = 'yyyy';
var resource_url = '/v1/developers/' + developer_id + '/plugins/' + plugin_id + '/installs.json';
@alanef
alanef / freemius.php
Last active December 1, 2021 14:58
Handle contact form
<?php
/** @var \Freemius $myfreemiustag_fs Freemius global object. */
global $myfreemiustag_fs;
if ( ! isset( $myfreemiustag_fs ) ) {
// Include Freemius SDK.
require_once 'mypath/includes/vendor/freemius/wordpress-sdk/start.php';
$myfreemiustag_fs = fs_dynamic_init( array(
'id' => '10000',
@alanef
alanef / bitof.php
Last active January 8, 2022 14:22
/* code to check if logged in to a different WP site example.com */
$logged_in_cookie = 'wordpress_logged_in_' . md5( 'https://example.com' );
if ( ! isset($_COOKIE[ $logged_in_cookie ]) ) {
// display adverts
}
$gravity_view_frontend = \GravityView_frontend::getInstance();
remove_filter('the_title', [$gravity_view_frontend, 'single_entry_title'], 1, 2);
.help-tip {
position: absolute;
text-align: center;
background-color: #409EBB;
border-radius: 50%;
width: 15px;
height: 15px;
font-size: 12px;
line-height: 17px;
cursor: default;
var isIE = window.document.documentMode ? true : false;
if ( isIE ) {
window.location.replace("https://my-site/new-page");
}
<?php
// this should be in top template I think
enqueue_script('wfea-slideshow-script');
$speed=apply_filters('wfea_slideshow_speed', $speed);
$script_vars = 'var wfea_slider_speed = ' . $speed . ';' .
'var wfea_slider_count = ' . $data->atts['limit'] . ';';
wp_add_inline_script( 'wfea-slideshow-script', $script_vars, 'before' );
?>
<div class="wfea-slides" style="position: absolute;top: 0;left: 0;bottom: 0; right: 0;"> // style in CSS?
@alanef
alanef / slider.js
Last active October 11, 2021 18:54
// wfea_slide_count set externally
// wfea_slide_speed milliseconds set externally
(function ($) {
function specific_slide(num) {
while ( num != counter ) {
counter++;
if (counter > wfea_slide_count ) {
counter = 1;
}
<head>
<style>
.vfx-slideshow {
position: relative;
}
.vfx-slideshow > div:not(:first-child) {
display:none;
}
.vfx-slideshow > div {