Skip to content

Instantly share code, notes, and snippets.

@andreiglingeanu

andreiglingeanu/functions.php Secret

Created Apr 2, 2021
Embed
What would you like to do?
<?php
add_action('blocksy:pro:content-blocks:pre-output', function ($id) {
if (! class_exists('Qubely')) {
return;
}
if (! class_exists('Blocksy_Qubely')) {
eval("class Blocksy_Qubely extends Qubely {
public function __construct() {}
}");
}
add_action('wp_enqueue_scripts', function () use ($id) {
global $post;
$old_post = $post;
$hook = get_post($id);
$post = $hook;
setup_postdata($hook);
$qubely_driver = new \Blocksy_Qubely();
$qubely_driver->qubely_enqueue_style();
$qubely_driver->qubely_enqueue_scripts();
wp_reset_postdata();
$post = $old_post;
});
$option_data = get_option( 'qubely_options' );
$css_save_as = isset(
$option_data['css_save_as']
) ? $option_data['css_save_as'] : 'wp_head';
if ($css_save_as == 'filesystem') {
add_action(
'wp_enqueue_scripts',
function () use ($id) {
global $post;
$old_post = $post;
$hook = get_post($id);
$post = $hook;
setup_postdata($hook);
$qubely_driver = new \Blocksy_Qubely();
$qubely_driver->enqueue_block_css_file();
wp_reset_postdata();
$post = $old_post;
}
);
} else {
add_action(
'wp_head',
function () use ($id) {
global $post;
$old_post = $post;
$hook = get_post($id);
$post = $hook;
setup_postdata($hook);
$qubely_driver = new \Blocksy_Qubely();
$qubely_driver->add_block_inline_css();
wp_reset_postdata();
$post = $old_post;
},
100
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment