/**
  * Enqueue the scripts and styles used with the page builder.
  */
 public function enqueue_scripts($hook_suffix)
 {
     global $pagenow;
     // Only load resources if they are needed on the current page
     if (!in_array($hook_suffix, array('post.php', 'post-new.php')) || !ttfmake_post_type_supports_builder(get_post_type())) {
         return;
     }
     wp_enqueue_script('ttfmake-admin-edit-page', get_template_directory_uri() . '/inc/builder-custom/js/edit-page.js', array('jquery'), spine_get_script_version(), true);
     wp_enqueue_style('wsuwp-builder-styles', get_template_directory_uri() . '/builder-templates/css/sections.css', array(), spine_get_script_version());
     wp_enqueue_script('wsuwp-builder-actions', get_template_directory_uri() . '/builder-templates/js/builder-actions.js', array('jquery'), spine_get_script_version(), true);
     wp_enqueue_script('wsuwp-builder-two-columns', get_template_directory_uri() . '/builder-templates/js/two-columns.js', array(), spine_get_script_version(), true);
     wp_localize_script('ttfmake-admin-edit-page', 'ttfmakeEditPageData', array('pageNow' => esc_js($pagenow)));
 }
Ejemplo n.º 2
0
        /**
         * Print out the JS section templates
         *
         * @since  1.0.0.
         *
         * @return void
         */
        public function print_templates()
        {
            global $hook_suffix, $typenow, $ttfmake_is_js_template;
            $ttfmake_is_js_template = true;
            // Only show when adding/editing pages
            if (!ttfmake_post_type_supports_builder($typenow) || !in_array($hook_suffix, array('post.php', 'post-new.php'))) {
                return;
            }
            // Define the templates to print
            $templates = array(array('id' => 'gallery-item', 'builder_template' => 'sections/builder-templates/gallery-item', 'path' => 'inc/builder/'), array('id' => 'banner-slide', 'builder_template' => 'sections/builder-templates/banner-slide', 'path' => 'inc/builder/'));
            // Print the templates
            foreach ($templates as $template) {
                ?>
		<script type="text/html" id="tmpl-ttfmake-<?php 
                echo $template['id'];
                ?>
">
			<?php 
                ob_start();
                ttfmake_get_builder_base()->load_section($template, array());
                $html = ob_get_clean();
                $html = str_replace(array('temp'), array('{{{ id }}}'), $html);
                echo $html;
                ?>
		</script>
		<?php 
            }
            unset($GLOBALS['ttfmake_is_js_template']);
        }
Ejemplo n.º 3
0
Archivo: base.php Proyecto: fovoc/make
        /**
         * Print out the JS section templates
         *
         * @since  1.0.0.
         *
         * @return void
         */
        public function print_templates()
        {
            global $hook_suffix, $typenow, $ttfmake_is_js_template;
            $ttfmake_is_js_template = true;
            // Only show when adding/editing pages
            if (!ttfmake_post_type_supports_builder($typenow) || !in_array($hook_suffix, array('post.php', 'post-new.php'))) {
                return;
            }
            // Print the templates
            foreach (ttfmake_get_sections() as $section) {
                ?>
			<script type="text/html" id="tmpl-ttfmake-<?php 
                echo esc_attr($section['id']);
                ?>
">
			<?php 
                ob_start();
                $this->load_section($section, array());
                $html = ob_get_clean();
                echo $html;
                ?>
		</script>
		<?php 
            }
            unset($GLOBALS['ttfmake_is_js_template']);
            // Load the overlay for TinyMCE
            get_template_part('/inc/builder/core/templates/overlay', 'tinymce');
            // Print the template for removing images
            ?>
			<script type="text/html" id="tmpl-ttfmake-remove-image">
				<div class="ttfmake-remove-current-image">
					<h3><?php 
            esc_html_e('Current image', 'make');
            ?>
</h3>
					<a href="#" class="ttfmake-remove-image-from-modal">
						<?php 
            esc_html_e('Remove Current Image', 'make');
            ?>
					</a>
				</div>
			</script>
		<?php 
        }
        /**
         * Print out the JS section templates
         *
         * @since  1.0.0.
         *
         * @return void
         */
        public function print_templates()
        {
            global $hook_suffix, $typenow, $ttfmake_is_js_template;
            $ttfmake_is_js_template = true;
            // Only show when adding/editing pages
            if (!ttfmake_post_type_supports_builder($typenow) || !in_array($hook_suffix, array('post.php', 'post-new.php'))) {
                return;
            }
            /**
             * Array of items to print as JS templates in the footer of the Builder screen.
             *
             * Each item is represented as an associative array and includes the following items:
             * - id                  The ID of the template
             * - builder_template    The relative path to the PHP template
             * - path                The path to the base directory
             *
             * @since 1.6.0.
             *
             * @param array    $templates    The
             */
            $templates = apply_filters('make_builder_js_templates', array(array('id' => 'gallery-item', 'builder_template' => 'sections/builder-templates/gallery-item', 'path' => 'inc/builder/'), array('id' => 'banner-slide', 'builder_template' => 'sections/builder-templates/banner-slide', 'path' => 'inc/builder/')));
            // Print the templates
            foreach ($templates as $template) {
                ?>
		<script type="text/html" id="tmpl-ttfmake-<?php 
                echo $template['id'];
                ?>
">
			<?php 
                ob_start();
                ttfmake_get_builder_base()->load_section($template, array());
                $html = ob_get_clean();
                $html = str_replace(array('temp'), array('{{{ id }}}'), $html);
                echo $html;
                ?>
		</script>
		<?php 
            }
            unset($GLOBALS['ttfmake_is_js_template']);
        }
Ejemplo n.º 5
0
        /**
         * Print out the JS section templates
         *
         * @since  1.0.0.
         *
         * @return void
         */
        public function print_templates()
        {
            global $hook_suffix, $typenow, $ttfmake_is_js_template;
            $ttfmake_is_js_template = true;
            // Only show when adding/editing pages
            if (!ttfmake_post_type_supports_builder($typenow) || !in_array($hook_suffix, array('post.php', 'post-new.php'))) {
                return;
            }
            // Print the templates
            foreach (ttfmake_get_sections() as $key => $section) {
                ?>
			<script type="text/html" id="tmpl-ttfmake-<?php 
                echo esc_attr($section['id']);
                ?>
">
			<?php 
                ob_start();
                $this->load_section($section, array());
                $html = ob_get_clean();
                $html = str_replace(array('temp'), array('{{{ id }}}'), $html);
                echo $html;
                ?>
		</script>
		<?php 
            }
            unset($GLOBALS['ttfmake_is_js_template']);
        }