Skip to content

Instantly share code, notes, and snippets.

View wurwal's full-sized avatar

Thomas Wurwal wurwal

  • Rawww
  • Coventry
View GitHub Profile
/* adding green text formatting to mce editor */
function wpb_mce_buttons_2($buttons) {
array_unshift($buttons, 'styleselect');
return $buttons;
}
add_filter('mce_buttons_2', 'wpb_mce_buttons_2');
/*
@wurwal
wurwal / acf-export-2019-08-09.json
Last active August 9, 2019 09:47
ACF Repeater and sub repeater integrated into Foundations Horizontal Tabs
[
{
"key": "group_5d499dde6bd04",
"title": "Repeating_Tabs",
"fields": [
{
"key": "field_5d49a08552d96",
"label": "Repeating Tabs",
"name": "download_tabs",
"type": "repeater",
@wurwal
wurwal / gist:5ab153d58317f8cb8f89146b3ebbf2f2
Created December 6, 2019 11:46
Woo Product Entry Validation code
/* product entry validation STARTS */
// product entry validation - weight on simple products
add_action( 'admin_head', 'require_weight_field' );
function require_weight_field() {
$screen = get_current_screen();
$screen_id = $screen ? $screen->id : '';
if ( $screen_id == 'product' ) {
?>
@wurwal
wurwal / gist:c3cb4d7308154d9e623faf9457837b7e
Created April 3, 2020 17:41
FacetWP - print out selected facets to a div with id 'output' in a comma separated line dynamically
jQuery(document).on('facetwp-loaded', function() {
var facetname = "facet-name-here";
var data = FWP.facets[facetname];
var string = data.toString();
var stringFormatted1 = string.replace(/-/g, ' ');
<?php
function role_admin_body_class( $classes ) {
global $current_user;
foreach( $current_user->roles as $role )
$classes .= ' role-' . $role;
return trim( $classes );
}
add_filter( 'admin_body_class', 'role_admin_body_class' );
function wp_admin_field_css() {
@wurwal
wurwal / ux.js additions
Last active August 18, 2020 15:36
tt ux.js additions
//ADD
// Fixing bug in reveal on mobile devices
var scrollPosition = 0;
var modalOpen = false;
var $reveal = $('.reveal');
$reveal.on('closeme.zf.reveal', function() {
if(!modalOpen) scrollPosition = $(document).scrollTop();
});
// where do you need cover?
a.wherecover-popover-close {
font-size: 35px;
position: absolute;
right: 16px;
top: -5px;
z-index: 99999;
color: $darkgrey;
}
<!-- 20200828 - iPhone edit start -->
<style type="text/css">
@media screen and (max-width: 1023px) {
#from {z-index:-10;}
}
</style>
<!-- 20200828 - iPhone edit end -->
<div class="arrivalWrapper left pr">
<!-- line 3481 -->
<div class="form-break">
<div class="row">
<div class="small-12 columns">
<label class="pr">
Your email
<i id="iconEmailCorrect" style="display: none;" class="fas fa-check-circle validatedicon"></i>
<i id="iconEmailIncorrect" class="fas fa-times-circle invalidatedicon"></i>
</label>
</div>
// force children of category to inherit it's category template http://werdswords.com/force-sub-categories-use-the-parent-category-template/
function new_subcategory_hierarchy() {
$category = get_queried_object();
$parent_id = $category->category_parent;
$templates = array();
if ( $parent_id == 0 ) {