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 / oxygenbuilder2_manage_edit_column_apply_to.php
Last active July 16, 2018 00:50
Oxygenbuilder2 Template overview Add Column "Apply To" and "In Use"
<?php
/**
* Add a apply_to and in_use column to Oxygenbuilder2.0's ct_templates overview.
* It will:
* - tell you the rules on the templates
* - show you if a re-usable is being used on a post/page/cpt so if not, you can safely delete it.
*/
add_filter('manage_edit-ct_template_columns', 'add_new_ct_template_columns');
/**
@badabingbreda
badabingbreda / jquery.bbpaneloptions.js
Last active June 30, 2018 20:10
Jquery Plugin to extend the Beaver Builder Editor Sidepanel and Topbar
/*! BeaverBuilder Add Panel Option for jQuery v1.00
* http://www.badabing.nl/jquery-plugins/beaverbuilder-paneloptions/
* Do not remove any of this notice (you're welcome to use this code in commercial projects)
* Copyright (c) 2016 Didou Schol www.badabing.nl
* Licensed under the MIT license */
( function ( $ ) {
$.extend ({
bbAddPanel: function ( options ) {
// DEFAULT OPTIONS
@badabingbreda
badabingbreda / toolbox_example_add_custom_acfimage_classes.php
Created June 18, 2018 19:22
Toolbox Example - Adding custom classes to acfimage
<?php
add_filter( 'toolbox/helpers/sc_attr/type=image' , 'add_image_class_attr' , 10 ,1 );
// add a custom attribute named 'myclass'
function add_image_class_attr( $attr ) {
$attr['myclass'] = '';
return $attr;
}
@badabingbreda
badabingbreda / toolbox_example_add_own_sc_attr_defaults.php
Last active June 18, 2018 18:53
Toolbox Example - Adding your own set of SC Attribute Defaults
<?php
add_filter( 'toolbox/helpers/sc_attr/type=new_fieldtype', 'my_own_attr_defaults' , 10 , 1 );
function my_own_attr_defaults ( $attr = array() ) {
$new_attr = array(
'field' => '',
'format' => null,
'allowempty' => 'false',
'postid' => 0,
@badabingbreda
badabingbreda / toolbox_example_add_sc_attr.php
Created June 18, 2018 18:39
Toolbox Example - Add sc_attr default settings
<?php
add_filter( 'toolbox/helpers/sc_attr/type=new_fieldtype' , 'toolbox::return_shortcode_attr_default' , 10, 1 );
@badabingbreda
badabingbreda / toolbox_example_extending_timber_posts_data.php
Created June 18, 2018 17:25
Toolbox Example - extending timber posts data
<?php
add_filter( 'toolbox_timber_posts_data' , 'my_custom_data' ,10 ,1 );
function my_custom_data( $data ) {
$data['mydata'] = array(
'firstname' => 'John',
'lastname' => 'Doe'
);
@badabingbreda
badabingbreda / toolbox_example_custom_text_codefield_filter.php
Created June 17, 2018 17:01
Toolbox Example - Custom Text Codefield Filter
<?php
add_filter( 'toolbox/helpers/get_acf_field/type=text', 'my_text_codefield_filter', 10, 5 );
/**
* Your custom filter for a text-field with the name 'codefield'
*/
public static function my_text_codefield_filter( $string , $field_object , $value , $atts = null , $postid = null ) {
// check if the requested fieldname is 'codefield' and the type of the field_object is 'text'
// if so, append and prepend the string by <code></code>
@badabingbreda
badabingbreda / toolbox_example_default_text_filter.php
Created June 17, 2018 16:42
Toolbox Example - default text filter
<?php
/**
* Default return function for a text or unknown fieldtype
*/
public static function acf_return_text( $string , $field_object , $value , $atts = null , $postid = null ) {
if ( is_array( $value ) ) return $string;
return $string . $value;
}
@badabingbreda
badabingbreda / toolbox_example_adding_youtubepicker_fieldtype.php
Created June 12, 2018 19:11
toolbox - Example Adding the Youtubepicker Fieldtype
<?php
add_filter( 'toolbox/helpers/settings/type=youtubepicker' , 'toolboxConnectors::settings_text', 10, 2 );
add_filter( 'toolbox/helpers/sc_attr/type=youtubepicker' , 'toolbox::return_shortcode_attr_default' , 10, 1 );
// add_filter( 'toolbox/helpers/get_acf_field/type=youtubepicker' , 'toolbox::post_object_to_array' , 20, 5 );
add_filter( 'toolbox/helpers/get_acf_field/type=youtubepicker' , 'display_youtubepicker' , 10, 5 );
/**
@badabingbreda
badabingbreda / toolbox-using-acf-fields.twig
Created June 11, 2018 20:32
Toolbox - How to use an ACF field on your ACF Field Module
{% for item in __field__ %}
<h3>{{item.title}}</h3>
<p>{{item.preview(100)}}</p>
{% endfor %}