This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* function to add observer | |
*/ | |
function inViewport(selector, callback, options = {}) { | |
const elems = document.querySelectorAll( selector ); | |
function observerCallback(entries, observer) { | |
entries.forEach(entry => callback(entry)) | |
}; | |
const observer = new IntersectionObserver( observerCallback , options ); | |
elems.forEach( (i) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mb_block_renderer($attributes, $is_preview = false, $post_id = null) | |
{ | |
$context = Timber::context(); | |
$context['content'] = $attributes['data']; | |
$context['is_preview'] = $is_preview; | |
$context['post_id'] = $post_id; | |
Timber::render("blocks/{$attributes['name']}.twig", $context); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Beaver Builder Global JS Reset | |
Description: Resets global JS and self deactivates. | |
Author: <Simon> | |
Version: 1.0 | |
*/ | |
class BB_Global_JS_Reset { | |
function __construct() { | |
include_once ABSPATH . '/wp-admin/includes/plugin.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
// https://snippet-generator.app/ | |
"Metabox meta_box": { | |
"prefix": "__mb_meta_box", | |
"body": [ | |
"add_filter( 'rwmb_meta_boxes', '${1:my_new_metabox_callback}' );", | |
"/**", | |
" * Create a Meta Box, anonymously", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set userid = __node__.starter_user|default( function( 'get_current_user_id' ) ) %} | |
{% set userdata = User( userid ) %} | |
<div class="uk-tile uk-tile-muted uk-padding-small uk-grid-small" uk-grid> | |
<div class="uk-width-1-1 uk-width-1-3@s"> | |
<img data-src="{{userdata.avatar}}" uk-img> | |
</div> | |
<div class="uk-width-1-1 uk-width-2-3@s"> | |
<h3>{{userdata.user_nicename}}</h3> | |
<p>{{userdata.description?'About the author:<br>'~userdata.description:'no description given.'}}</p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
Plugin Name: Toolbox Starter Plugin | |
Plugin URI: https://www.toolboxstarterplugin.com/ | |
Description: Starter Plugin for Toolbox, Using Timber | |
Version: 1.0 | |
Author: Didou Schol | |
Text Domain: textdomain | |
Domain Path: /languages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Callback used to return the users of this WP site | |
* @return array | |
*/ | |
function starter_return_users() { | |
$select_options = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ), |
NewerOlder