function get_rendered_item() { $item_id = explode('-', $_REQUEST['id']); if (count($item_id) == 2) { global $wp_query; query_posts('page_id=' . $item_id[0]); query_posts(array('p' => $item_id[0], 'post_type' => $item_id[1])); ob_start(); wp_head(); $header = ob_get_contents(); ob_end_clean(); ob_start(); include RHC_PATH . 'templates/calendar-single-post.php'; $content = ob_get_contents(); ob_end_clean(); ob_start(); wp_footer(); $footer = ob_get_contents(); ob_end_clean(); $response = (object) array('R' => 'OK', 'MSG' => '', 'DATA' => array('body' => $content, 'footer' => $footer)); die(json_encode($response)); } else { die(json_encode(array('R' => 'ERR', 'MSG' => __('Invalid item id', 'rhc')))); } }
function render_footer() { $builder_link = '<a href="http://ithemes.com/purchase/builder-theme/" title="iThemes Builder">iThemes Builder</a>'; $ithemes_link = '<a href="http://ithemes.com/" title="iThemes WordPress Themes">iThemes</a>'; $wordpress_link = '<a href="http://wordpress.org">WordPress</a> & hosted by <a href="http://www.siteground.com/wordpress-hosting.htm" target="_blank">SiteGround WordPress Hosting</a>'; $footer_credit = sprintf(__('%1$s by %2$s<br />Powered by %3$s', 'it-l10n-Builder-Paige'), $builder_link, $ithemes_link, $wordpress_link); $footer_credit = apply_filters('builder_footer_credit', $footer_credit); ?> <div class="alignleft"> <strong><?php bloginfo('name'); ?> </strong><br /> <?php printf(__('Copyright © %s All Rights Reserved', 'it-l10n-Builder-Paige'), date('Y')); ?> </div> <div class="alignright"> <?php echo $footer_credit; ?> </div> <?php wp_footer(); }
/** * Display primary footer content. */ function thesis_footer() { echo "\t<div id=\"footer\">\n"; thesis_hook_footer(); thesis_admin_link(); wp_footer(); echo "\t</div>\n"; }
/** * Display primary footer content. */ function thesis_footer() { echo ' <div id="footer">' . "\n"; thesis_hook_footer(); thesis_admin_link(); wp_footer(); echo ' </div>' . "\n"; }
function test_selector_in_footer() { $post_id = $this->factory->post->create(); $this->go_to(get_permalink($post_id)); ob_start(); wp_footer(); $footer = ob_get_clean(); $this->assertGreaterThanOrEqual(0, strpos('<div class="emoji-reaction-selector"', $footer)); }
public function renderPage($templateName, $templateVars = false) { echo $this->render('header', ChesterWPCoreDataHelpers::getBlogInfoData()); wp_head(); echo $this->render('header_close', array('siteTitleHTML' => self::renderSiteTitle())); echo $this->render($templateName, $templateVars); wp_footer(); echo $this->render('footer'); }
/** * Print head + template + footer * * @param string $templateName Template name to print * @param array $templateVars Parameters to template */ public function renderPage($templateName, $templateVars = []) { // HEAD ob_start(); wp_head(); $wpHead = ob_get_clean(); // FOOTER ob_start(); wp_footer(); $wpFooter = ob_get_clean(); return $this->render($templateName, array_merge($templateVars, ['wp_head' => $wpHead, 'wp_footer' => $wpFooter])); }
function bizz_html_footer() { do_action('bizz_foot_grid'); #hook do_action('bizz_foot_before'); #hook wp_footer(); #wp #hook do_action('bizz_foot_after'); #hook echo "</body>\n</html>"; #END <body> and <html> tags }
function html5slidesjs() { ?> <script> function addPrettify() { var els = document.querySelectorAll('pre'); for (var i = 0, el; el = els[i]; i++) { if (!el.classList.contains('noprettyprint')) { el.classList.add('prettyprint'); } } var el = document.createElement('script'); el.type = 'text/javascript'; el.src = '<?php echo plugins_url('js/prettify.js', __FILE__); ?> '; el.onload = function() { prettyPrint(); } document.body.appendChild(el); }; function addGeneralStyle() { var el = document.createElement('link'); el.rel = 'stylesheet'; el.type = 'text/css'; el.href = '/css/html5-presentation.css'; document.body.appendChild(el); var el = document.createElement('meta'); el.name = 'viewport'; el.content = 'width=1100,height=750'; document.querySelector('head').appendChild(el); var el = document.createElement('meta'); el.name = 'apple-mobile-web-app-capable'; el.content = 'yes'; document.querySelector('head').appendChild(el); }; </script> <?php if (get_option('include-wp_footer')) { wp_footer(); } }
function content() { ?> <div class="grid_12"> <div id="<?php echo $this->get_id(); ?> " role="contentinfo"> <div id="colophon"> <div id="site-info"> <a href="<?php echo home_url('/'); ?> " title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> " rel="home"> <?php bloginfo('name'); ?> </a> </div><!-- #site-info --> <div id="site-generator"> <?php do_action('twentyten_credits'); ?> <a href="<?php echo esc_url(__('http://wordpress.org/', 'wordcampbase')); ?> " title="<?php esc_attr_e('Semantic Personal Publishing Platform', 'wordcampbase'); ?> " rel="generator"><?php printf(__('Proudly powered by %s.', 'wordcampbase'), 'WordPress'); ?> </a> </div><!-- #site-generator --> </div><!-- #colophon --> </div><!-- #footer --> </div> <?php /* Always have wp_footer() just before the closing </body> * tag of your theme, or you will break many plugins, which * generally use this hook to reference JavaScript files. */ wp_footer(); }
function wpb_genesis_footer() { //genesis_structural_wrap( 'site-inner', 'close' ); //echo '</div>'; //* end .site-inner or #inner do_action('genesis_before_footer'); do_action('genesis_footer'); do_action('genesis_after_footer'); echo '</div>'; //* end .site-container or #wrap do_action('genesis_after'); wp_footer(); //* we need this for plugins ?> </body> </html> <?php }
function process_render($callback, $callback_arg) { global $wp_scripts, $wp_styles; // initial scripts & styles (to subtract) ob_start(); wp_head(); wp_footer(); ob_end_clean(); $initial_scripts = $wp_scripts->done; $initial_styles = $wp_styles->done; // actually render the shortcode, get the result, and do the resource loading again so we can subtract.. ob_start(); wp_head(); ob_end_clean(); $result = call_user_func($callback, $callback_arg); ob_start(); wp_footer(); ob_end_clean(); // find the difference (the new resource files) $loaded_scripts = array_diff($wp_scripts->done, $initial_scripts); $loaded_styles = array_diff($wp_styles->done, $initial_styles); return array('result' => $result, 'loaded_scripts' => $loaded_scripts, 'loaded_styles' => $loaded_styles); }
function op_footer() { do_action('op_footer'); //Init the scripts array $js_scripts = array('tooltipster.min.js', 'selectnav.min.js', 'dropkick.js', 'jquery/jquery-ui-1.10.3.custom.min.js', 'jquery/jquery.sharrre-1.3.4.min.js', 'jquery/jquery.reveal.js', 'jquery/countdown.js', 'global.js'); //Init the frontend array, which will then be converted to JSON if (!is_admin()) { op_localize_script('front'); wp_enqueue_script('op-menus', OP_JS . 'menus.js', array()); } //Print out script include foreach ($js_scripts as $script) { echo '<script type="text/javascript" src="' . OP_JS . $script . '"></script>'; } //Print out footer scripts op_print_footer_scripts('front'); wp_footer(); //Return (which will not allow user in), if the user does not have permissions if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) { return; } if (!get_user_option('rich_editing')) { return; } //If we are previewing, run the following script $preview = !empty($_GET['preview']) ? $_GET['preview'] : false; echo $preview ? ' <script type="text/javascript"> jQuery(\'#TB_window\', window.parent.document).css({marginLeft: \'-\' + parseInt((1050 / 2),10) + \'px\',width:\'1050px\',height:\'600px\'}); jQuery(\'#TB_iframeContent\', window.parent.document).css({width:\'1050px\',height:\'600px\'}); </script> ' : ''; //Insert tracking scripts $tracking = op_default_option('analytics_and_tracking'); echo !empty($tracking['google_analytics_tracking_code']) ? stripslashes($tracking['google_analytics_tracking_code']) : ''; echo !empty($tracking['sitewide_tracking_code']) ? stripslashes($tracking['sitewide_tracking_code']) : ''; }
/** * Output the content for the wp_footer() method; */ function the_wp_footer_html() { wp_footer(); }
<div class="footer-wrapper"> <div class="footer-main"> <div class="footer-left"> <a><img src="<? bloginfo('template_url');?>/Images/logo-footer2.png" alt="" /></a> <p>Design&create by<a href="#">www.aliot.eu</a></p> </div> <div class="footer-right"> <a><img src="<? bloginfo('template_url');?>/Images/footer-twitter.png" alt="" /></a> <a><img src="<? bloginfo('template_url');?>/Images/footer-facebook.png" alt="" /></a> </div> </div> </div> </body> <script> $(function(){ $(window).load(function(){ $('#slide_2').liSlidik({ auto:3000, duration: 1000 }); }) }); </script> <? wp_footer();?> </html>
function premise_footer() { do_action('premise_before_footer'); wp_footer(); do_action('premise_after_footer'); }
/** * Render Receipt in the Browser * * A link is added to the Purchase Receipt to view the email in the browser and * this function renders the Purchase Receipt in the browser. It overrides the * Purchase Receipt template and provides its only styling. * * @since 1.5 * @author Sunny Ratilal */ function edd_render_receipt_in_browser() { if (!isset($_GET['payment_key'])) { wp_die(__('Missing purchase key.', 'edd'), __('Error', 'edd')); } $key = urlencode($_GET['payment_key']); ob_start(); ?> <!DOCTYPE html> <html lang="en"> <title><?php _e('Receipt', 'edd'); ?> </title> <meta charset="utf-8" /> <?php wp_head(); ?> </html> <body class="<?php echo apply_filters('edd_receipt_page_body_class', 'edd_receipt_page'); ?> "> <div id="edd_receipt_wrapper"> <?php do_action('edd_render_receipt_in_browser_before'); ?> <?php echo do_shortcode('[edd_receipt payment_key=' . $key . ']'); ?> <?php do_action('edd_render_receipt_in_browser_after'); ?> </div> <?php wp_footer(); ?> </body> <?php echo ob_get_clean(); die; }
<footer class="motopress-wrapper footer"> <div class="container"> <div class="row"> <div class="span12" data-motopress-wrapper-file="wrapper/wrapper-footer.php" data-motopress-wrapper-type="footer" data-motopress-id="<?php echo uniqid() ?>"> <?php get_template_part('wrapper/wrapper-footer'); ?> </div> </div> </div> </footer> <!--End #motopress-main--> </div> <div id="back-top-wrapper" class="visible-desktop"> <p id="back-top"> <a href="#top"><span></span></a> </p> </div> <?php wp_footer(); ?> <!-- this is used by many Wordpress features and for plugins to work properly --> <?php if(of_get_option('ga_code')) { ?> <script type="text/javascript"> <?php echo stripslashes(of_get_option('ga_code')); ?> </script> <!-- Show Google Analytics --> <?php } ?> </body> </html>
/** * WPZOOM public footer */ public static function footer() { /** * Call WordPress footer hook */ wp_footer(); }
'container_id' => null, 'menu_class' => 'menu-footer', 'menu_id' => null, 'echo' => true, 'fallback_cb' => null, 'before' => null, 'after' => null, 'link_before' => null, 'link_after' => null, 'items_wrap' => '<div class="%2$s"><ul>%3$s</ul></div>', 'depth' => 1, 'walker' => ( has_nav_menu( $menuLocationName ) ) ? ( new wm_widget_walker() ) : ( null ) ) ); $class = ( is_page_template( 'page-template/construction.php' ) ) ? ( 'text-center clearfix' ) : ( 'clearfix' ); wm_credits( $class ); ?> </div> </div></section> <!-- /bottom-wrap --> <!-- /footer --></footer> <?php do_action( 'wm_after_website' ); ?> <!-- wp_footer() --> <?php wp_footer(); //WordPress footer hook ?> </body> <?php if ( ! wm_option( 'general-website-author' ) ) echo '<!-- ' . wm_static_option( 'static-webdesigner' ) . ' -->'; ?> </html>
* In this files there is a collection of a functions useful for the core * of the framework. * * @package WordPress * @subpackage Your Inspiration Themes * @author Your Inspiration Themes Team <*****@*****.**> * * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.gnu.org/licenses/gpl-3.0.txt */ ?> <?php /** * @see yit_footer */ do_action( 'yit_footer') ?> </div> <!-- END WRAPPER --> <?php do_action( 'yit_after_wrapper' ) ?> </div> <!-- END BG SHADOW --> <?php wp_footer() ?> </body> <!-- END BODY --> </html>
?> <div class="col-xs-<? echo $col_num; ?> col-md-<? echo $col_num; ?>" id="<? echo substr(esc_html($value['icon']), 3); ?>"> <a href="<?php echo $link; ?>" target="_blank"><i class="fa <? echo esc_html($value['icon']); ?> fa-3x"></i></a> </div> <? } ?> </div> </div> <?php } ?> </div> <!-- LAYER OVER THE SLIDER TO MAKE THE WHITE TEXT READABLE --> <div id="layer"></div> <!-- END LAYER --> <div id="slider" class="rev_slider"> <ul> <li data-transition="slideleft" data-slotamount="1" data-thumb="<?php if ( $rc_mmip_inside_bgopt == 0){ echo $rc_mmip_default_bg; }else{ echo $rc_mmip_inside_custom_img; } ?>"> <img src="<?php if ( $rc_mmip_inside_bgopt == 0){ echo esc_url($rc_mmip_default_bg); }else{ echo esc_url($rc_mmip_inside_custom_img); } ?>"> </li> </ul> </div> </section> <!-- END HEADER --> </body> <!-- END BODY --> </html> <?php wp_footer(); ?>
/** * Outputs a blank page containing a slideshow preview (for use in the 'Preview' iFrame) */ public function do_preview() { remove_action('wp_footer', 'wp_admin_bar_render', 1000); if (isset($_GET['slider_id']) && absint($_GET['slider_id']) > 0) { $id = absint($_GET['slider_id']); ?> <!DOCTYPE html> <html> <head> <style type='text/css'> body, html { overflow: hidden; margin: 0; padding: 0; } </style> <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="0" /> </head> <body> <?php echo do_shortcode("[metaslider id={$id}]"); ?> <?php wp_footer(); ?> </body> </html> <?php } die; }
/** * Runs the query and returns the results via JSON. * Triggered by an AJAX request. * * @global $wp_query * @global $wp_the_query * @uses current_theme_supports, get_option, self::wp_query, self::set_last_post_time, current_user_can, apply_filters, self::get_settings, add_filter, WP_Query, remove_filter, have_posts, wp_head, do_action, add_action, this::render, this::has_wrapper, esc_attr, wp_footer, sharing_register_post_for_share_counts, get_the_id * @return string or null */ function query() { if (!isset($_GET['page']) || !current_theme_supports('infinite-scroll')) { die; } $page = (int) $_GET['page']; $sticky = get_option('sticky_posts'); $post__not_in = self::wp_query()->get('post__not_in'); if (!empty($post__not_in)) { $sticky = array_unique(array_merge($sticky, $post__not_in)); } if (!empty($_GET['date'])) { self::set_last_post_time($_GET['date']); } $post_status = array('publish'); if (current_user_can('read_private_posts')) { array_push($post_status, 'private'); } $order = in_array($_GET['order'], array('ASC', 'DESC')) ? $_GET['order'] : 'DESC'; $query_args = array_merge(self::wp_query()->query_vars, array('paged' => $page, 'post_status' => $post_status, 'posts_per_page' => self::get_settings()->posts_per_page, 'post__not_in' => (array) $sticky, 'order' => $order)); // By default, don't query for a specific page of a paged post object. // This argument can come from merging self::wp_query() into $query_args above. // Since IS is only used on archives, we should always display the first page of any paged content. unset($query_args['page']); $query_args = apply_filters('infinite_scroll_query_args', $query_args); // Add query filter that checks for posts below the date add_filter('posts_where', array($this, 'query_time_filter'), 10, 2); $GLOBALS['wp_the_query'] = $GLOBALS['wp_query'] = new WP_Query($query_args); remove_filter('posts_where', array($this, 'query_time_filter'), 10, 2); $results = array(); if (have_posts()) { // Fire wp_head to ensure that all necessary scripts are enqueued. Output isn't used, but scripts are extracted in self::action_wp_footer. ob_start(); wp_head(); ob_end_clean(); $results['type'] = 'success'; // First, try theme's specified rendering handler, either specified via `add_theme_support` or by hooking to this action directly. ob_start(); do_action('infinite_scroll_render'); $results['html'] = ob_get_clean(); // Fall back if a theme doesn't specify a rendering function. Because themes may hook additional functions to the `infinite_scroll_render` action, `has_action()` is ineffective here. if (empty($results['html'])) { add_action('infinite_scroll_render', array($this, 'render')); rewind_posts(); ob_start(); do_action('infinite_scroll_render'); $results['html'] = ob_get_clean(); } // If primary and fallback rendering methods fail, prevent further IS rendering attempts. Otherwise, wrap the output if requested. if (empty($results['html'])) { unset($results['html']); do_action('infinite_scroll_empty'); $results['type'] = 'empty'; } elseif ($this->has_wrapper()) { $wrapper_classes = is_string(self::get_settings()->wrapper) ? self::get_settings()->wrapper : 'infinite-wrap'; $wrapper_classes .= ' infinite-view-' . $page; $wrapper_classes = trim($wrapper_classes); $results['html'] = '<div class="' . esc_attr($wrapper_classes) . '" id="infinite-view-' . $page . '" data-page-num="' . $page . '">' . $results['html'] . '</div>'; } // Fire wp_footer to ensure that all necessary scripts are enqueued. Output isn't used, but scripts are extracted in self::action_wp_footer. ob_start(); wp_footer(); ob_end_clean(); // Loop through posts to capture sharing data for new posts loaded via Infinite Scroll if ('success' == $results['type'] && function_exists('sharing_register_post_for_share_counts')) { global $jetpack_sharing_counts; while (have_posts()) { the_post(); sharing_register_post_for_share_counts(get_the_ID()); } $results['postflair'] = array_flip($jetpack_sharing_counts); } } else { do_action('infinite_scroll_empty'); $results['type'] = 'empty'; } echo json_encode(apply_filters('infinite_scroll_results', $results, $query_args, self::wp_query())); die; }
case 'dropdown': echo '<select name="' . $field['id'] . '" id="' . $field['id'] . '" data-old="' . $meta . '" class="' . $raw_option_id . '">'; foreach ($field['options'] as $value => $label) { echo '<option', $meta == $value ? ' selected="selected"' : '', ' value="' . $value . '">' . __($label, 'landing-pages') . '</option>'; } echo '</select>'; break; } //end switch echo '</div></div>'; } // end foreach echo '</div>'; // end table } } /* CREATE WYSIWYG EDITOR */ function lp_wp_editor($content, $id, $settings = array()) { //echo $id; $content = apply_filters('lp_wp_editor_content', $content); $id = apply_filters('lp_wp_editor_id', $id);
/** * When PHP has finished, we output the footer scripts and closing tags */ function output_buffer($in_shutdown = FALSE) { // If the footer scripts haven't been outputted, then // we need to take action - as they're required if (!$this->wrote_footer) { // If W3TC is installed and activated, we can't output the // scripts and manipulate the buffer, so we can only provide a warning if (defined('W3TC') && defined('WP_DEBUG') && WP_DEBUG && !is_admin()) { if (!defined('DONOTCACHEPAGE')) { define('DONOTCACHEPAGE', TRUE); } if (!did_action('wp_footer')) { error_log("We're sorry, but your theme's page template didn't make a call to wp_footer(), which is required by NextGEN Gallery. Please add this call to your page templates."); } else { error_log("We're sorry, but your theme's page template didn't make a call to wp_print_footer_scripts(), which is required by NextGEN Gallery. Please add this call to your page templates."); } } elseif (strpos($this->buffer, '</body>') === FALSE) { $this->valid_request = FALSE; } // The output_buffer() function has been called in the PHP shutdown callback // This will allow us to print the scripts ourselves and manipulate the buffer if ($in_shutdown === TRUE) { if ($this->valid_request) { ob_start(); if (!did_action('wp_footer')) { wp_footer(); } else { wp_print_footer_scripts(); } $this->other_output = ob_get_clean(); $this->buffer = str_ireplace('</body>', $this->marker . '</body>', $this->buffer); } } else { $this->run_shutdown = TRUE; return ''; } } // Once we have the footer scripts, we can modify the buffer and // move the resources around if ($this->wrote_footer) { $this->move_resources(); } return $this->buffer; }
/** * Return an array of recent posts */ public static function get_posts() { $is_page = false; // Apply our 'since' parameter function o2_filter_posts_where($where = '') { global $o2_since, $wpdb; if (!$o2_since) { return $where; } $holdoff = 3; // seconds - gives time for posts to "bake" (e.g. if meta is added after post insertion or update) $since = date('Y-m-d H:i:s', $o2_since); // start of range $until = date('Y-m-d H:i:s', time() - $holdoff); // end of range $where .= $wpdb->prepare(" AND post_modified_gmt > %s AND post_modified_gmt < %s", $since, $until); return $where; } // Add filters to posts query add_filter('posts_where', 'o2_filter_posts_where'); // Post stati $post_stati = array('publish', 'trash'); if (current_user_can('read_private_posts')) { array_push($post_stati, 'private'); } // Override post stati on $args as read is unauthenticated $args = array(); if (isset($_REQUEST['queryVars'])) { $args = $_REQUEST['queryVars']; } $args['post_status'] = $post_stati; $defaults = array('post_type' => 'post', 'post_status' => $post_stati, 'posts_per_page' => 20, 'ignore_sticky_posts' => true, 'suppress_filters' => false); $query_args = wp_parse_args($args, $defaults); // If we are on a page, change the query post_type to page, otherwise // we will get no data (and updates to pages will not be sent to polling // clients on that page) [using an array of post and page doesn't work either] if (isset($query_args['pagename'])) { $query_args['post_type'] = 'page'; } // Filter for plugins $query_args = apply_filters('o2_get_posts_query_args', $query_args); // Run the query for posts $GLOBALS['wp_the_query'] = $GLOBALS['wp_query'] = new WP_Query($query_args); // Set as is_home() to ensure that plugin filters run on the_content() $GLOBALS['wp_query']->is_home = true; // Remove filters from query remove_filter('pre_option_posts_per_rss', 'o2_posts_per_rss'); remove_filter('posts_where', 'o2_filter_posts_where'); $posts = array(); // Run through The Loop global $post; if (have_posts()) { ob_start(); wp_head(); ob_end_clean(); while (have_posts()) { the_post(); if (self::is_ok_to_add($post)) { $posts[] = $post; } } ob_start(); wp_footer(); ob_end_clean(); } else { if (0 != intval($_REQUEST['postId'])) { /* * If WP_Query returned no posts and if currently on a single page, then * query the postID and check if it has been trashed. This is workaround * for the ticket below. * * @todo Remove second query with get_post when the below ticket is addressed. * https://core.trac.wordpress.org/ticket/29167 */ $post = get_post(intval($_REQUEST['postId'])); if ('trash' == $post->post_status) { if (self::is_ok_to_add($post)) { $posts[] = $post; } } } } return $posts; }
function aviators_templates_helpers_wp_footer() { wp_footer(); }
</a> <?php } ?> </div><!-- --><div class="col-footer col-footer-contact"> <p class="hidden" >contact@amillion.fr<span class="ss-standard ss-mail"></span></p> <p class="hidden" >438.821.9107<span class="ss-standard ss-phone"></span></p> <p class="hidden" ><a class="ss-icon ss-social" target="_blank" href="https://www.facebook.com/millionbeats/"></a><a class="ss-icon ss-social" target="_blank" href="https://twitter.com/MillionBeats"></a></p> </div> </div> <div class='bottom-bar'></div> </footer> <script src="wp-content/themes/amillion/js/main.js"></script> <script src="wp-content/themes/amillion/js/home.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js"></script> <script src="wp-content/themes/amillion/js/jsmovieclip-1.js"></script> <?php wp_footer(); ?> </body> </html>
/** * Called by AJAX action themify_builder_loader. * 1. Hooks the load_front_js_css function to wp_footer * 2. Saves scripts and styles already loaded in page * 3. Executes wp_head and wp_footer to load new scripts from load_front_js_css. Dismisses output * 4. Compiles list of new styles and scripts to load and js vars to pass * 5. Echoes list * * @since 2.1.9 */ public function async_load_builder() { add_action('wp_footer', array($this, 'load_frontend_interface')); global $wp_scripts, $wp_styles; $done_styles = isset($_POST['styles']) ? $_POST['styles'] : array(); $done_scripts = isset($_POST['scripts']) ? $_POST['scripts'] : array(); ob_start(); wp_head(); wp_footer(); ob_end_clean(); $results = array(); $new_styles = array_diff($wp_styles->done, $done_styles); $new_scripts = array_diff($wp_scripts->done, $done_scripts); if (!empty($new_styles)) { $results['styles'] = array(); foreach ($new_styles as $handle) { // Abort if somehow the handle doesn't correspond to a registered stylesheet if (!isset($wp_styles->registered[$handle])) { continue; } // Provide basic style data $style_data = array('handle' => $handle, 'media' => 'all'); // Base source $src = $wp_styles->registered[$handle]->src; // Take base_url into account if (strpos($src, 'http') !== 0) { $src = $wp_styles->base_url . $src; } // Version and additional arguments if (null === $wp_styles->registered[$handle]->ver) { $ver = ''; } else { $ver = $wp_styles->registered[$handle]->ver ? $wp_styles->registered[$handle]->ver : $wp_styles->default_version; } if (isset($wp_styles->args[$handle])) { $ver = $ver ? $ver . '&' . $wp_styles->args[$handle] : $wp_styles->args[$handle]; } // Full stylesheet source with version info $style_data['src'] = add_query_arg('ver', $ver, $src); // Parse stylesheet's conditional comments if present, converting to logic executable in JS if (isset($wp_styles->registered[$handle]->extra['conditional']) && $wp_styles->registered[$handle]->extra['conditional']) { // First, convert conditional comment operators to standard logical operators. %ver is replaced in JS with the IE version $style_data['conditional'] = str_replace(array('lte', 'lt', 'gte', 'gt'), array('%ver <=', '%ver <', '%ver >=', '%ver >'), $wp_styles->registered[$handle]->extra['conditional']); // Next, replace any !IE checks. These shouldn't be present since WP's conditional stylesheet implementation doesn't support them, but someone could be _doing_it_wrong(). $style_data['conditional'] = preg_replace('#!\\s*IE(\\s*\\d+){0}#i', '1==2', $style_data['conditional']); // Lastly, remove the IE strings $style_data['conditional'] = str_replace('IE', '', $style_data['conditional']); } // Parse requested media context for stylesheet if (isset($wp_styles->registered[$handle]->args)) { $style_data['media'] = esc_attr($wp_styles->registered[$handle]->args); } // Add stylesheet to data that will be returned to IS JS array_push($results['styles'], $style_data); } } if (!empty($new_scripts)) { $results['scripts'] = array(); foreach ($new_scripts as $handle) { // Abort if somehow the handle doesn't correspond to a registered script if (!isset($wp_scripts->registered[$handle])) { continue; } // Provide basic script data $script_data = array('handle' => $handle, 'footer' => is_array($wp_scripts->in_footer) && in_array($handle, $wp_scripts->in_footer), 'jsVars' => $wp_scripts->print_extra_script($handle, false)); // Base source $src = $wp_scripts->registered[$handle]->src; // Take base_url into account if (strpos($src, 'http') !== 0) { $src = $wp_scripts->base_url . $src; } // Version and additional arguments if (null === $wp_scripts->registered[$handle]->ver) { $ver = ''; } else { $ver = $wp_scripts->registered[$handle]->ver ? $wp_scripts->registered[$handle]->ver : $wp_scripts->default_version; } if (isset($wp_scripts->args[$handle])) { $ver = $ver ? $ver . '&' . $wp_scripts->args[$handle] : $wp_scripts->args[$handle]; } // Full script source with version info $script_data['src'] = add_query_arg('ver', $ver, $src); // Add script to data that will be returned to IS JS array_push($results['scripts'], $script_data); } } echo json_encode($results); die; }