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
const handleClick(e){ | |
console.log('this target has been clicked:', e.currentTarget); | |
} | |
elementsList.forEach(e => e.addEventListener('click', handleClick, false)); | |
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, $block) | |
{ | |
$context = Timber::context(); | |
$context['attributes'] = $attributes; | |
$context['is_preview'] = defined('REST_REQUEST') && REST_REQUEST; | |
$context['post_id'] = get_the_ID(); | |
$context['PREFIX'] = PREFIX; | |
$block_name = end(explode('/', $block->name)); | |
Timber::render("blocks/{$block_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
add_action('init', function () { | |
unregister_taxonomy_for_object_type('post_tag', 'post'); | |
//unregister_taxonomy_for_object_type('category', 'post'); | |
}); |
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
add_filter( 'ajax_query_attachments_args', 'wpb_show_current_user_attachments' ); | |
function wpb_show_current_user_attachments( $query ) { | |
$user_id = get_current_user_id(); | |
//has the capability to activate plugins or edit other user’s posts? if not limit files to users id | |
if ( $user_id && !current_user_can('activate_plugins') && !current_user_can('edit_others_posts | |
') ) { | |
$query['author'] = $user_id; | |
} | |
return $query; |
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 translations() | |
{ | |
add_filter( | |
"get_term", | |
function ($term, $tax) { | |
if (is_admin()) { | |
return $term; | |
} | |
$fixes = [ |
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 ak_disable_blocks($allowed_blocks, $post) | |
{ | |
//get all blocks | |
$registered_blocks = WP_Block_Type_Registry::get_instance()->get_all_registered(); | |
//list all blocks | |
//var_dump(array_keys($registered_blocks)); | |
//exit(); | |
//disable unwanted blocks |
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
require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
//Your Plugins here | |
$required_plugins = [ | |
'Meta Box' => is_plugin_active('meta-box/meta-box.php'), | |
'MB Admin Columns' => is_plugin_active('mb-admin-columns/mb-admin-columns.php'), | |
]; | |
//Alternative Plugins here | |
$required_plugins_alt = [ |