Skip to content

Instantly share code, notes, and snippets.

Avatar

Kurt Zenisek KZeni

View GitHub Profile
@KZeni
KZeni / reports.php
Last active December 3, 2022 07:35
View reports.php
<?php
/*
Plugin - WP ADA Compliance Check
functions to support dipslay or reports and reference pages
*/
/**********************************************
REFRESH REPORT PAGE
********************************************/
function wp_ada_compliance_basic_refresh_report_page(){
@KZeni
KZeni / material design blogger template.xml
Created December 15, 2014 20:23
Material Design Blogger Template
View material design blogger template.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html b:version='2' class='v2' expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<b:include data='blog' name='all-head-content'/>
<meta content='width=device-width, initial-scale=1, minimum-scale=1' name='viewport'/>
<title>
<data:blog.pageTitle/>
</title>
<b:skin><![CDATA[
View fancybox-call.js
// Fancybox Lightbox
//$('a[href^="#"][href$="-bio"]').attr('data-fancybox', '').attr('data-selectable', 'true').attr('data-type', 'inline');
$('a[href*="youtu.be"],a[href*="youtube.com/watch?v="]').attr('data-fancybox', '').attr('data-width', '1280').attr('data-height', '720'); // Catch links to YouTube videos, but don't catch normal YouTube.com links (links to channel, etc.) Give them a width & height (720p) (while it's then mobile-responsive & also doesn't take up the whole screen [offering its own fullscreen option if they want to see it bigger.])
//$('.event-bio').attr('data-selectable', 'true');
// $('a[href*=".pdf"],a.pdf,.pdf a').each(function () {
// // Make PDFs scrollable on mobile devices via PDF.js
// if (location.hostname === this.hostname || !this.hostname.length) {
// // Make sure the file is being served from an external site (avoid origin issues from trying to load that content via JS)
// $(this)
// .attr('href', '/wp-content/themes/brit/pdfjs/web/viewer.html?file=' + $(this).attr('
@KZeni
KZeni / functions.php
Last active June 27, 2022 16:57
Add start date from The Events Calendar to Display Posts plugin's output
View functions.php
<?php
/**
* Add custom fields to Display Posts Shortcode
* @author Bill Erickson
* @link http://wordpress.org/extend/plugins/display-posts-shortcode/
* @link http://www.billerickson.net/shortcode-to-display-posts/comment-page-1/#comment-4565
*
* @param $output string, the original markup for an individual post
* @param $atts array, all the attributes passed to the shortcode
* @param $image string, the image part of the output
@KZeni
KZeni / How to create a polygon in WP Google Maps from existing region or boundary data.md
Last active June 17, 2022 21:05
How to create a polygon in WP Google Maps from existing region/boundary data (countries, states, provinces, counties, regions, etc.) Ex. https://gist.github.com/KZeni/348b6e0a8298a91ed75fd5ec409a49c9 is US States created using this exact process.
View How to create a polygon in WP Google Maps from existing region or boundary data.md

If it shows up as a region when searching via https://nominatim.openstreetmap.org then this process will work. This includes countries, states, counties, cities, parks, and more. OpenStreetMap can be a very valuable tool for map data (the Wikipedia of maps, in a way.)

Free-handing the polygons via the WP Google Maps polygon editor is an option (click to place/remove points, etc. when adding/editing a polygon on a map), but below gets officially detailed & accurate data that prevents overlapping, gaps, and can save time depending on how accurate you want the polygon(s) to be. Below involves a fair number of steps, but this should be the entire process & each step should be rather quick.

https://gis.stackexchange.com/a/192298/151627 and https://gis.stackexchange.com/a/284305/151627 kinda outline the start of things, but here’s the full set of steps.

  1. Do a search for the
@KZeni
KZeni / rpwe-add-time.php
Created March 29, 2022 06:23
Add Time to Recent Post Widgets Extended (RPWE) WordPress plugin output (uses Simple HTML DOM PHP [1.9.1 here] to aid in the HTML traversing & insertion])
View rpwe-add-time.php
<?php
// Add Simple HTML DOM for PHP-based HTML/DOM Traversal
if(!function_exists('str_get_html')){
include 'include/simple_html_dom.php';
}
// Add Time info to Recent Post Widgets Extended output (add after date)
function add_time_to_rpwe_markup($html,$args){
$html = str_get_html($html);
foreach($html->find('.rpwe-title a') as $title_link){
@KZeni
KZeni / rpwe-add-author.php
Created March 29, 2022 06:11
Add Post Author to Recent Post Widgets Extended (RPWE) WordPress plugin output (uses Simple HTML DOM PHP [1.9.1 here] to aid in the HTML traversing & insertion])
View rpwe-add-author.php
<?php
// Add Simple HTML DOM for PHP-based HTML/DOM Traversal
if(!function_exists('str_get_html')){
include 'include/simple_html_dom.php';
}
// Add Author info to Recent Post Widgets Extended output (add before date)
function add_author_to_rpwe_markup($html,$args){
$html = str_get_html($html);
foreach($html->find('.rpwe-title a') as $title_link){
View the-events-calendar-event-tickets-attendee-unique-name.js
// Force the Name field in the Event Ticket (Plus) ticket attendee information is unique (which may be intentionally hidden [which makes this even more important since you can see/fix the issue of the name fields needing to be unique per Event Tickets for The Events Calendar, currently & oddly.])
function makeEventTicketAttendeeNamesUnique() {
$('.tribe-tickets__iac-field--name .tribe-tickets__form-field-input').each(function (i) {
if (!$(this).hasClass('duplicate-prevented')) {
var originalValue = $(this).val();
$(this).val(originalValue + ' #' + (i + 1));
$(this).addClass('duplicate-prevented');
}
});
}
@KZeni
KZeni / kurtzenisek_id_rsa.pub
Created January 29, 2021 20:45
kurtzenisek_id_rsa.pub / kurtzenisek_authorized_keys (Public SSH/SFTP/etc. key for kurtzenisek)
View kurtzenisek_id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDALsG2QVvkcAl17quJAS1SsYLdgIZ9VPPJVMZQl8FxQA2/baxS5FmReB3LK8ljTB0FLrGCmWNKGiiWG/7l2gtC4rlV0RGAwNz4+AIhS938u/WDimB6A6IIK5zMYHYs90rGARPOegD+tdxYhmAvol97o+XvN248j/e0Lu+sO+cDbnXBe1vSIIpznRHtluISPyWiPX2xlDpIWMkfr4IdMgaCMub766hqsi7pYJv2GqwNm0hwTlJjBNpbzrV5Dr38fNCXed5cIWoaJeB3UC98OMi+D08qgXpTIzSq4oWKz2nA8KNZVvPkqkCG9JrHj9pGsvJw+0O4RWrgYja+kySi5vkx
@KZeni
KZeni / edit-1.md
Last active October 20, 2020 20:58
Gravity Forms - Prevent truncating list of choices on radio & checkbox fields on editor views
View edit-1.md

gravityforms/includes/fields/class-gf-field-radio.php has:

if ( $is_form_editor && $count >= 5 ) {
	$editor_limited = true;
	break;
}

changed into:

$gf_radio_field_editor_choice_limit = apply_filters( 'gf_radio_field_editor_choice_limit', 5); // Default to 5 being the limit but allow a different value to be specified via filter