function blox_template_load_hook() { try { $content = ''; $templates = blox_get_template(); foreach ($templates as $template) { if ($template['id'] == $_POST['id']) { $content = stripslashes($template['content']); } } echo $content; } catch (Exception $e) { echo "-1"; } exit; }
function theme_after_switch_hook() { themeton_less_init(); $filename = trailingslashit(get_template_directory()) . "framework/addons/wordpress-importer/files/blox-templates.txt"; if (file_exists($filename)) { $file_data = file_get_contents(file_require($filename), FILE_USE_INCLUDE_PATH); $blox_templates = blox_get_template(); if (!empty($file_data) && empty($blox_templates)) { set_theme_mod('blox_templates', trim($file_data)); } } exit; }
function render_blox_pagebuilder() { //wp_nonce_field(plugin_basename(__FILE__), 'myplugin_noncename'); global $post; ?> <div id="blox_template_storage" style="display: none;"> <?php $templates = blox_get_template(); foreach ($templates as $template) { echo '<span><a href="javascript: blox_load_template("' . $template['id'] . '");" data-template="' . $template['id'] . '">' . $template['title'] . '</a><i class="fa-times" onclick="blox_remove_template(jQuery(this));"></i></span>'; } ?> </div> <input type="hidden" id="blox_uri_admin_ajax" value="<?php echo site_url(); ?> /wp-admin/admin-ajax.php" /> <div class="blox_nav clearfix"> <a href="javascript:;" class="button" id="blox_add_row"><i class="fa fa-plus-circle"></i> <span>Add Row</span></a> <a href="javascript:;" class="button" id="blox_add_element"><i class="fa fa-plus-circle"></i> <span>Add Element</span></a> <div class="pull-right"> <a href="javascript: switch_blox_builder(false);" id="blox-switch-classic" class="button-primary inline-buttons" title="Switch Classic Editor"><i class="fa-arrow-circle-left"></i> <span>Switch Classic Editor</span></a> <a href="javascript:;" class="button button-primary inline-buttons" id="blox_fullscreen"><i class="fa-arrows-alt"></i> <span>Fullscreen</span></a> <span class="button blox-dropdown inline-buttons" id="blox_templates"> Template <i class="fa fa-angle-down"></i> <span class="blox_templates_wrapper"> <span class="template_container"> <div id="blox_template_list" class="blox_template_list"></div> <a href="javascript: blox_save_template();" class="button-primary">Save Entry as Template</a> </span> </span> </span> <a href="javascript:;" class="button" id="blox_trigger_publish"><i class="fa-globe"></i> <span>Publish</span></a> </div> </div> <div id="blox_preview"></div> <div id="blox_popup_window"> <div class="blox_popup_toolbar"> <div> <span class="title"></span> <a href="javascript:;" class="button blox_popup_button_close"> Close </a> <a href="javascript:;" class="button-primary blox_popup_button_update"> Update Element </a> </div> </div> <div class="blox_popup_wrapper"></div> </div> <?php }