Skip to content

Instantly share code, notes, and snippets.

View badabingbreda's full-sized avatar

Didou Schol badabingbreda

  • Breda, Netherlands
View GitHub Profile
@badabingbreda
badabingbreda / toolbox_docs_plugin_development_alias_module_sep_twig.php
Last active October 23, 2019 12:08
Toolbox Docs: Plugin Development Alias Module by inclusion as a seperate twig template
<?php
/**
* Starter Plugin User Info Alias Module
* USER INFO
* @since 1.0
*/
\FLBuilder::register_module_alias( 'starter-user-info', array(
'module' => 'acftimber',
'name' => __( 'User Info', 'textdomain' ),
<?php
/**
* Class Name: your_themename_top_menu
* Description: A custom WordPress nav walker class to implement UIkit menu markup
*/
class your_themename_top_menu extends Walker_Nav_Menu {
/**
* @see Walker::start_lvl()
* @since 3.0.0
@badabingbreda
badabingbreda / toolbox_example_dynamic_group_filter_js.js
Created April 5, 2019 20:54
Toolbox Example: Dynamic Group Filter JS
jQuery( '.chooser' ).on( 'click' , function( event ) {
var $this = jQuery(this);
var term = $this.data('term');
if ( $this.hasClass( 'uk-button-primary' ) ) {
var $unterm = jQuery( '.shadow[data-term="' + term + '"]' );
UIkit.filter('[uk-filter="target: .js-filter"]', { target: ".js-filter" } ).apply( $unterm );
} else {
UIkit.filter('[uk-filter="target: .js-filter"]', { target: ".js-filter" } ).apply( $this );
}
@badabingbreda
badabingbreda / toolbox_example_dynamic_group_filter_twig.twig
Last active April 5, 2019 20:52
Toolbox Example: Dynamic Group Filter Twig
{% macro getterms( taxonomy ) %}
{% set terms = function( 'get_terms' , { 'taxonomy': taxonomy , 'hide_empty' : true } ) %}
{% for item in terms %}
{% if item.slug != 'uncategorized' %}
<div>
<ul class="uk-subnav uk-subnav-pill" uk-margin>
<li class="filterbutton" uk-filter-control="filter: [data-{{item.slug}}='true']; group: {{item.slug}}">
<a href="#">{{item.name}}</a>
</li>
</ul>
@badabingbreda
badabingbreda / toolbox_example_adding_relationship_settings.php
Created April 5, 2019 15:29
Toolbox Example: Adding Relationship settings to Toolbox Field Module and Connector
<?php
add_filter( 'toolbox/helpers/settings/type=relationship' , 'my_relationship_settings' , 10, 2 );
function my_relationship_settings( $settings , $type = '' ) {
return array_merge($settings , array(
'relationship_subfield' => array(
'type' => 'text',
@badabingbreda
badabingbreda / cookie-connector-ajax.php
Created January 17, 2019 09:21
Cookie Connector Cookie Script
@badabingbreda
badabingbreda / ACF_user_field_selectbox_returnlabel.php
Created December 20, 2018 10:47
Change ACF User Field selectbox returnlabel
<?php
/**
* Write the data to a file
*
* @param [type] $filename [description]
* @param [type] $data [description]
* @return [type] [description]
*/
function writedata( $filename, $data ) {
@badabingbreda
badabingbreda / youtube_defer_loading.html
Created November 10, 2018 08:28
Youtube defer loading to click
<html>
<head>
<title>Youtube defer loading</title>
<!-- CSS -->
<style>
.youtube {
background-color: #000;
margin-bottom: 30px;
position: relative;
padding-top: 56.25%;
@badabingbreda
badabingbreda / ACF_number_format_with_classes.php
Last active October 25, 2018 20:36
ACF number format with classes
<?php
/**
* return number_formatted fieldvalue by adding classes to number field in Field Group
*
* my-currency : return as formatted number 1999 becomes 1,999
* my-currency-dec-# : set the number of decimals to return, # is the number of decimals (needs at least one character)
*/
add_filter( 'acf/load_value/type=number', 'my_check_number_classes', 10, 3 );
@badabingbreda
badabingbreda / acf_580beta1_block.php
Created October 18, 2018 09:05
ACF Pro 5.8.0-beta1 Custom Block
<?php
/**
* STEP 1: add code below to functions.php
*
* STEP 2: after adding this code you can add the fields to a block called My Custom Block.
* It will be available to select in the ACF Plugin AFTER this code has been added.
*
* Add these fields to the Fieldgroup for this block:
*