/**
 * Category Description
 *
 * @since 1.0.4
 */
function dslc_sc_category_description($atts, $content)
{
    extract(shortcode_atts(array('category_ID' => false), $atts));
    // If category ID not supplied, get current category
    if (!$category_ID) {
        $category_ID = get_query_var('cat');
    }
    // Get category description
    $category_description = category_description($category_ID);
    // Placeholder description
    if (!is_category() && empty($category_description) && dslc_is_editor_active('access')) {
        $category_description = __('Category description will be shown here.', 'live-composer-page-builder');
    }
    // Return category description
    return $category_description;
}
    function module_start($options)
    {
        global $dslc_should_filter;
        $dslc_should_filter = false;
        if (!isset($options['css_anim'])) {
            $options['css_anim'] = 'none';
        }
        if (!isset($options['css_anim_delay'])) {
            $options['css_anim_delay'] = '0';
        }
        if (!isset($options['css_anim_duration'])) {
            $options['css_anim_duration'] = '650';
        }
        if (!isset($options['css_anim_easing'])) {
            $options['css_anim_easing'] = 'default';
        }
        $options['module_id'] = $this->module_id;
        /**
         * Size Classes
         */
        $class_size_output = '';
        $data_attr_size = '12';
        if (isset($options['dslc_m_size'])) {
            $class_size_output .= ' dslc-col dslc-' . $options['dslc_m_size'] . '-col';
            $data_attr_size = $options['dslc_m_size'];
        }
        if (isset($options['dslc_m_size_last']) && $options['dslc_m_size_last'] == 'yes') {
            $class_size_output .= ' dslc-last-col';
        }
        /**
         * Show on ( desktop, tablet, phone )
         */
        $class_show_on = '';
        if (isset($options['css_show_on'])) {
            $show_on = explode(' ', trim($options['css_show_on']));
            if (!in_array('desktop', $show_on)) {
                $class_show_on .= 'dslc-hide-on-desktop ';
            }
            if (!in_array('tablet', $show_on)) {
                $class_show_on .= 'dslc-hide-on-tablet ';
            }
            if (!in_array('phone', $show_on)) {
                $class_show_on .= 'dslc-hide-on-phone ';
            }
        }
        /**
         * Handle like
         */
        if (isset($this->handle_like)) {
            $class_handle_like = 'dslc-module-handle-like-' . $this->handle_like;
        } else {
            $class_handle_like = 'dslc-module-handle-like-regular';
        }
        /**
         * Globals
         */
        global $dslc_css_style;
        global $dslc_googlefonts_array;
        global $dslc_all_googlefonts_array;
        /**
         * Title Attr
         */
        $title_attr = '';
        if (dslc_is_editor_active()) {
            $title_attr = 'title="' . strtoupper(esc_attr($this->module_title)) . '"';
        }
        ?>

		<div id="dslc-module-<?php 
        echo $options['module_instance_id'];
        ?>
" class="dslc-module-front dslc-module-<?php 
        echo $this->module_id;
        ?>
 dslc-in-viewport-check dslc-in-viewport-anim-<?php 
        echo $options['css_anim'];
        ?>
 <?php 
        echo $class_size_output . ' ' . $class_show_on . ' ' . $class_handle_like;
        ?>
" data-module-id="<?php 
        echo $options['module_instance_id'];
        ?>
" data-dslc-module-id="<?php 
        echo $this->module_id;
        ?>
" data-dslc-module-size="<?php 
        echo $data_attr_size;
        ?>
" data-dslc-anim="<?php 
        echo $options['css_anim'];
        ?>
" data-dslc-anim-delay="<?php 
        echo $options['css_anim_delay'];
        ?>
" data-dslc-anim-duration="<?php 
        echo $options['css_anim_duration'];
        ?>
"  data-dslc-anim-easing="<?php 
        echo $options['css_anim_easing'];
        ?>
" data-dslc-preset="<?php 
        echo $options['css_load_preset'];
        ?>
" <?php 
        echo $title_attr;
        ?>
>

			<?php 
        do_action('dslc_module_before');
        ?>

			<?php 
        if (DS_LIVE_COMPOSER_ACTIVE && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) {
            ?>

				<style><?php 
            $options_arr = $this->options();
            if (isset($options['css_custom']) && $options['css_custom'] == 'disabled') {
            } else {
                dslc_generate_custom_css($options_arr, $options, true);
                $googlefonts_output = '';
                foreach ($dslc_googlefonts_array as $googlefont) {
                    if (in_array($googlefont, $dslc_all_googlefonts_array)) {
                        $googlefont = str_replace(' ', '+', $googlefont);
                        if ($googlefont != '') {
                            $googlefonts_output .= '@import url("//fonts.googleapis.com/css?family=' . $googlefont . ':100,200,300,400,500,600,700,800,900&subset=latin,latin-ext"); ';
                        }
                    }
                }
                echo $googlefonts_output;
                echo $dslc_css_style;
            }
            ?>
</style>
			
				<div class="dslca-module-manage">
					<span class="dslca-module-manage-line"></span>
					<div class="dslca-module-manage-inner">
						<a href="#" class="dslca-module-edit-hook"><span class="dslc-icon-cog"></span></a>				
						<a href="#" class="dslca-copy-module-hook"><span class="dslc-icon-copy"></span></a>
						<a href="#" class="dslca-move-module-hook"><span class="dslc-icon-move"></span></a>
						<a href="#" class="dslca-change-width-module-hook">
							<span class="dslc-icon-columns"></span>
							<div class="dslca-change-width-module-options">
								<span data-size="1">1/12</span><span data-size="2">2/12</span>
								<span data-size="3">3/12</span><span data-size="4">4/12</span>
								<span data-size="5">5/12</span><span data-size="6">6/12</span>
								<span data-size="7">7/12</span><span data-size="8">8/12</span>
								<span data-size="9">9/12</span><span data-size="10">10/12</span>
								<span data-size="11">11/12</span><span data-size="12">12/12</span>
							</div>
						</a>
						<a href="#" class="dslca-delete-module-hook"><span class="dslc-icon-remove"></span></a>
					</div>
					<?php 
            if (DS_LIVE_COMPOSER_DEV_MODE) {
                ?>
						<div class="dslca-module-manage-inner dslca-dev-mode">
							<a href="#" class="dslca-module-get-defaults-hook"><span class="dslc-icon-upload-alt"></span></a>				
						</div>
					<?php 
            }
            ?>
				</div>

			<?php 
        }
        ?>

		<?php 
    }
Beispiel #3
0
/**
 * Gets LC code of a specific post/page
 *
 * @since 1.0.2
 *
 * @param int  $postID 	ID of the post/page. Default false.
 * @param bool $draft 	If true will check for draft first. Default true.
 * @return string 		The LC code for the post/page. Empty string if no LC code.
 */
function dslc_get_code($postID = false, $draft = true)
{
    // This will be returned at the end.
    $code = '';
    // If post ID not supplied ask WordPress.
    if (!$postID) {
        $postID = get_the_ID();
    }
    // If still no ID return false.
    if (!$postID) {
        return false;
    }
    // If draft allowed ( func parameter ) and editor currently active and there is a draft version
    if ($draft && dslc_is_editor_active() && get_post_meta($postID, 'dslc_code_draft', true)) {
        // Load draft LC code.
        $code = get_post_meta($postID, 'dslc_code_draft', true);
    } else {
        // Load regular ( current ) LC code.
        $code = get_post_meta($postID, 'dslc_code', true);
    }
    // Pass it back.
    return $code;
}
/**
 * Hooks into the_content filter to add LC elements
 *
 * @since 1.0
 */
function dslc_filter_content($content)
{
    // If post pass protected and pass not supplied return original content
    if (post_password_required(get_the_ID())) {
        return $content;
    }
    // Global variables
    global $dslc_should_filter;
    global $wp_the_query;
    global $dslc_post_types;
    // Get ID of the post in which the content filter fired
    $currID = get_the_ID();
    // Get ID of the post from the main query
    if (isset($wp_the_query->queried_object_id)) {
        $realID = $wp_the_query->queried_object_id;
    } else {
        $realID = 'nope';
    }
    // Check if we should we filtering the content
    // 1) Proceed if ID of the post in which content filter fired is same as the post ID from the main query
    // 2) Proceed if in a WordPress loop ( https://codex.wordpress.org/Function_Reference/in_the_loop )
    // 3) Proceed if global var $dslc_should_filter is true
    // Irrelevant of the other 3 proceed if archives, search or 404 page
    if ($currID == $realID && in_the_loop() && $dslc_should_filter || is_archive() || is_author() || is_search() || is_404()) {
        // Variables that are used throughout the function
        $composer_wrapper_before = '';
        $composer_wrapper_after = '';
        $composer_header_append = '';
        // HTML to output after LC header HTML
        $composer_footer_append = '';
        // HTML to otuput after LC footer HTML
        $composer_header = '';
        // HTML for LC header
        $composer_footer = '';
        // HTML for LC footer
        $composer_prepend = '';
        // HTML to output before LC content
        $composer_content = '';
        // HTML for LC content
        $composer_append = '';
        // HTML to ouput after LC content
        $template_code = false;
        // LC code if current post powered by template
        $template_ID = false;
        // ID of the template that powers current post
        // Wrapping all LC elements ( unless header/footer outputed by theme )
        if (!defined('DS_LIVE_COMPOSER_HF_AUTO') || DS_LIVE_COMPOSER_HF_AUTO) {
            $composer_wrapper_before = '<div id="dslc-content" class="dslc-content dslc-clearfix">';
            $composer_wrapper_after = '</div>';
        }
        // Get LC code of the current post
        $composer_code = dslc_get_code(get_the_ID());
        // Interactive Tutorials
        $tut_page = false;
        $tut_ch_one = dslc_get_option('lc_tut_chapter_one', 'dslc_plugin_options_tuts');
        $tut_ch_two = dslc_get_option('lc_tut_chapter_two', 'dslc_plugin_options_tuts');
        $tut_ch_three = dslc_get_option('lc_tut_chapter_three', 'dslc_plugin_options_tuts');
        $tut_ch_four = dslc_get_option('lc_tut_chapter_four', 'dslc_plugin_options_tuts');
        // If current page set to be tutorial chapter one or four
        if (get_the_ID() == $tut_ch_one || get_the_ID() == $tut_ch_four) {
            $tut_page = true;
            $composer_code = '';
            // If current page set to be tutorial chapter two
        } elseif (get_the_ID() == $tut_ch_two) {
            $tut_page = true;
            $composer_code = '[dslc_modules_section type="wrapped" columns_spacing="spacing" bg_color="rgb(242, 245, 247)" bg_image_thumb="disabled" bg_image="" bg_image_repeat="repeat" bg_image_position="left top" bg_image_attachment="scroll" bg_image_size="auto" bg_video="" bg_video_overlay_color="#000000" bg_video_overlay_opacity="0" border_color="" border_width="0" border_style="solid" border="top right bottom left" margin_h="0" margin_b="0" padding="85" padding_h="0" custom_class="" custom_id="" ] [dslc_modules_area last="yes" first="no" size="12"] [/dslc_modules_area] [/dslc_modules_section] ';
            // If current page set to be tutorial chapter three
        } elseif (get_the_ID() == $tut_ch_three) {
            $tut_page = true;
            $composer_code = '[dslc_modules_section type="wrapped" columns_spacing="spacing" bg_color="rgb(242, 245, 247)" bg_image_thumb="disabled" bg_image="" bg_image_repeat="repeat" bg_image_position="left top" bg_image_attachment="scroll" bg_image_size="auto" bg_video="" bg_video_overlay_color="#000000" bg_video_overlay_opacity="0" border_color="" border_width="0" border_style="solid" border="top right bottom left" margin_h="0" margin_b="0" padding="85" padding_h="0" custom_class="" custom_id="" ] [dslc_modules_area last="yes" first="no" size="12"] [/dslc_modules_area] [/dslc_modules_section] ';
        }
        // If currently showing a singular post of a post type that supports "post templates"
        if (is_singular($dslc_post_types)) {
            // Get template ID set for currently shown post
            $template_ID = dslc_st_get_template_ID(get_the_ID());
            // If template ID exists
            if ($template_ID) {
                // Get LC code of the template
                $composer_code = dslc_get_code($template_ID);
            }
        }
        // If currently showing a category archive page
        if (is_archive() && !is_author() && !is_search()) {
            // Get ID of the page set to power the category of the current post type
            $template_ID = dslc_get_option(get_post_type(), 'dslc_plugin_options_archives');
            // If there is a page that powers it
            if ($template_ID) {
                // Get LC code of the page
                $composer_code = dslc_get_code($template_ID);
            }
        }
        // If currently showing an author archive page
        if (is_author()) {
            // Get ID of the page set to power the author archives
            $template_ID = dslc_get_option('author', 'dslc_plugin_options_archives');
            // If there is a page that powers it
            if ($template_ID) {
                // Get LC code of the page
                $composer_code = dslc_get_code($template_ID);
            }
        }
        // If currently showing a search results page
        if (is_search()) {
            // Get ID of the page set to power the search results page
            $template_ID = dslc_get_option('search_results', 'dslc_plugin_options_archives');
            // If there is a page that powers it
            if ($template_ID) {
                // Get LC code of the page
                $composer_code = dslc_get_code($template_ID);
            }
        }
        // If currently showina 404 page
        if (is_404()) {
            // Get ID of the page set to power the 404 page
            $template_ID = dslc_get_option('404_page', 'dslc_plugin_options_archives');
            // If there is a page that powers it
            if ($template_ID) {
                // Get LC code of the page
                $composer_code = dslc_get_code($template_ID);
            }
        }
        // If currently showing a singular post of a post type which is not "dslc_hf" ( used for header/footer )
        // And the constant DS_LIVE_COMPOSER_HF_AUTO is not defined or is set to false
        if (!is_singular('dslc_hf') && (!defined('DS_LIVE_COMPOSER_HF_AUTO') || DS_LIVE_COMPOSER_HF_AUTO)) {
            $composer_header = dslc_hf_get_header();
            $composer_footer = dslc_hf_get_footer();
        }
        // If editor is currently active clear the composer_prepend var
        if (dslc_is_editor_active('access')) {
            $composer_prepend = '';
        }
        // If editor is currently active generate the LC elements and store them in composer_append var
        if (dslc_is_editor_active('access')) {
            // Get the editor type from the settings
            $editor_type = dslc_get_option('lc_editor_type', 'dslc_plugin_options_other');
            // If no editor type set in settings
            if (empty($editor_type)) {
                // Default to "both" ( Visual and HTML )
                $editor_type = 'both';
            }
            // The "Add modules row" and "Import" buttons
            $composer_append = '<div class="dslca-add-modules-section">
				<span class="dslca-add-modules-section-hook"><span class="dslca-icon dslc-icon-align-justify"></span>' . __('Add Modules Row', 'live-composer-page-builder') . '</span>
				<span class="dslca-import-modules-section-hook"><span class="dslca-icon dslc-icon-download-alt"></span>' . __('Import', 'live-composer-page-builder') . '</span>
			</div>';
            // Start output fetching
            ob_start();
            ?>
				<div class="dslca-wp-editor">
					<div class="dslca-wp-editor-inner">
						<?php 
            if ($editor_type == 'visual') {
                wp_editor('', 'dslcawpeditor', array('quicktags' => false));
            } else {
                wp_editor('', 'dslcawpeditor');
            }
            ?>
						<div class="dslca-wp-editor-notification">
							<?php 
            _e('Module settings are being loaded. Save/Cancel actions will appear shortly.', 'live-composer-page-builder');
            ?>
						</div><!-- .dslca-wp-editor-notification -->
						<div class="dslca-wp-editor-actions">
							<span class="dslca-wp-editor-save-hook"><?php 
            _e('CONFIRM', 'live-composer-page-builder');
            ?>
</span>
							<span class="dslca-wp-editor-cancel-hook"><?php 
            _e('CANCEL', 'live-composer-page-builder');
            ?>
</span>
						</div>
					</div>
				</div>
			<?php 
            // Stop output fetching
            $composer_append .= ob_get_contents();
            ob_end_clean();
        }
        // If there is LC code to add to the content output
        if ($composer_code || $template_code) {
            // Turn the LC code into HTML code
            $composer_content = do_shortcode($composer_code);
            // If there is header or footer LC code to add to the content output
        } elseif ($composer_header || $composer_footer) {
            // If editor not active
            if (!DS_LIVE_COMPOSER_ACTIVE) {
                // Pass the LC header, regular content and LC footer
                return $composer_wrapper_before . $composer_header . '<div id="dslc-theme-content"><div id="dslc-theme-content-inner">' . $content . '</div></div>' . $composer_footer . $composer_wrapper_after;
            }
        } else {
            // If editor not active
            if (!DS_LIVE_COMPOSER_ACTIVE) {
                // Pass back the original wrapped in a div ( in case there's a need to style it )
                return '<div id="dslc-theme-content"><div id="dslc-theme-content-inner">' . $content . '</div></div>';
            }
        }
        // If singular post shown and has a featured image
        if (is_singular() && has_post_thumbnail(get_the_ID())) {
            // Hidden input holding value of the URL of the featured image of the shown post ( used by rows for BG image )
            $composer_append .= '<input type="hidden" id="dslca-post-data-thumb" value="' . apply_filters('dslc_row_bg_featured_image', wp_get_attachment_url(get_post_thumbnail_id(get_the_ID()))) . '" />';
        }
        // If current page is used for a tutorial
        if ($tut_page) {
            // Hidden input holding value of the current post ID
            $composer_append .= '<input type="hidden" id="dslca-tut-page" value="' . get_the_ID() . '" />';
        }
        // Get readable representation of the LC modules output ( textual output )
        $content_for_search = '';
        if (get_post_meta(get_the_ID(), 'dslc_content_for_search', true)) {
            $content_for_search = get_post_meta(get_the_ID(), 'dslc_content_for_search', true);
        }
        // If editor active include a textarea that holds readable representation of the output
        if (DS_LIVE_COMPOSER_ACTIVE) {
            $composer_append .= '<textarea id="dslca-content-for-search">' . $content_for_search . '</textarea>';
        }
        // Pass the filtered content output
        return $composer_wrapper_before . do_action('dslc_output_prepend') . $composer_header . '<div id="dslc-main">' . $composer_prepend . $composer_content . '</div>' . $composer_append . $composer_footer . do_action('dslc_output_append') . $composer_wrapper_after;
        // If LC should not filter the content
    } else {
        // Pass back the original wrapped in a div ( in case there's a need to style it )
        return '<div id="dslc-theme-content"><div id="dslc-theme-content-inner">' . $content . '</div></div>';
    }
}
Beispiel #5
0
/**
 * Get the footer output code
 *
 * @since 1.0.2
 *
 * @param int     $post_ID ID of the post/page. Default false.
 * @return string The HTML ouput of the footer for a defined post/page
 */
function dslc_hf_get_footer($post_ID = false)
{
    // Var defaults
    $append = '';
    $wrapper_end = '';
    // Wrap if header handled by theme
    if (defined('DS_LIVE_COMPOSER_HF_AUTO') && !DS_LIVE_COMPOSER_HF_AUTO) {
        $wrapper_end = '</div>';
    }
    // If the page displayed is header/footer, do not repeat
    if (is_singular('dslc_hf')) {
        return $wrapper_end;
    }
    // Get header/footer ID associated with the post
    $header_footer = dslc_hf_get_ID($post_ID);
    // If there is a footer applied
    if ($header_footer['footer'] && is_numeric($header_footer['footer'])) {
        // Get the footer LC code
        $footer_code = get_post_meta($header_footer['footer'], 'dslc_code', true);
        // If the "position" option value exists
        if (get_post_meta($header_footer['footer'], 'dslc_hf_position', true)) {
            // Set the "position" option value to the one from the settings
            $footer_position = get_post_meta($header_footer['footer'], 'dslc_hf_position', true);
        } else {
            // Set the "position" option value to default "relative"
            $footer_position = 'relative';
        }
        // If editor active? Add a link to the footer editing.
        if (dslc_is_editor_active('access')) {
            $footer_link = DSLC_EditorInterface::get_editor_link($header_footer['footer']);
            // Set the HTML for the edit overlay.
            $append = '<div class="dslc-hf-block-overlay"><a target="_blank" href="' . $footer_link . '" class="dslc-hf-block-overlay-button dslca-link">' . __('Edit Footer', 'live-composer-page-builder') . '</a></div>';
        }
        // Add the header code to the variable holder.
        return '<div id="dslc-footer"  class="dslc-footer-pos-' . $footer_position . '">' . do_shortcode($footer_code) . $append . '</div>' . $wrapper_end;
        // If no header applied
    } else {
        return '' . $wrapper_end;
    }
}
/**
 * Outputs content with modules
 *
 * @since 1.0
 */
function dslc_filter_content($content)
{
    if (post_password_required(get_the_ID())) {
        return $content;
    }
    global $dslc_should_filter;
    global $wp_the_query;
    global $dslc_post_types;
    global $dslc_is_content_filtered;
    $currID = get_the_ID();
    if (isset($wp_the_query->queried_object_id)) {
        $realID = $wp_the_query->queried_object_id;
    } else {
        $realID = 'nope';
    }
    // Should we filter the content?
    if ($currID == $realID && in_the_loop() && $dslc_should_filter || is_archive() || is_author() || is_search() || is_404()) {
        $dslc_is_content_filtered[$currID] = true;
        global $dslc_active;
        // Will hold the output
        $composer_header_append = '';
        $composer_footer_append = '';
        $header_code = '';
        $footer_code = '';
        $composer_header = '';
        $composer_footer = '';
        $composer_prepend = '';
        $composer_content = '';
        $composer_append = '';
        $template_code = false;
        // The composer code
        if (dslc_is_editor_active() && get_post_meta(get_the_ID(), 'dslc_code_draft', true)) {
            $composer_code = get_post_meta(get_the_ID(), 'dslc_code_draft', true);
        } else {
            $composer_code = get_post_meta(get_the_ID(), 'dslc_code', true);
        }
        $template_ID = false;
        // Tutorial
        $tut_page = false;
        $tut_ch_one = dslc_get_option('lc_tut_chapter_one', 'dslc_plugin_options_tuts');
        $tut_ch_two = dslc_get_option('lc_tut_chapter_two', 'dslc_plugin_options_tuts');
        $tut_ch_three = dslc_get_option('lc_tut_chapter_three', 'dslc_plugin_options_tuts');
        $tut_ch_four = dslc_get_option('lc_tut_chapter_four', 'dslc_plugin_options_tuts');
        if (get_the_ID() == $tut_ch_one || get_the_ID() == $tut_ch_four) {
            $tut_page = true;
            $composer_code = '';
        } elseif (get_the_ID() == $tut_ch_two) {
            $tut_page = true;
            $composer_code = '[dslc_modules_section type="wrapped" columns_spacing="spacing" bg_color="rgb(242, 245, 247)" bg_image_thumb="disabled" bg_image="" bg_image_repeat="repeat" bg_image_position="left top" bg_image_attachment="scroll" bg_image_size="auto" bg_video="" bg_video_overlay_color="#000000" bg_video_overlay_opacity="0" border_color="" border_width="0" border_style="solid" border="top right bottom left" margin_h="0" margin_b="0" padding="85" padding_h="0" custom_class="" custom_id="" ] [dslc_modules_area last="yes" first="no" size="12"] [/dslc_modules_area] [/dslc_modules_section] ';
        } elseif (get_the_ID() == $tut_ch_three) {
            $tut_page = true;
            $composer_code = '[dslc_modules_section type="wrapped" columns_spacing="spacing" bg_color="rgb(242, 245, 247)" bg_image_thumb="disabled" bg_image="" bg_image_repeat="repeat" bg_image_position="left top" bg_image_attachment="scroll" bg_image_size="auto" bg_video="" bg_video_overlay_color="#000000" bg_video_overlay_opacity="0" border_color="" border_width="0" border_style="solid" border="top right bottom left" margin_h="0" margin_b="0" padding="85" padding_h="0" custom_class="" custom_id="" ] [dslc_modules_area last="yes" first="no" size="12"] [/dslc_modules_area] [/dslc_modules_section] ';
        }
        // If single, load template
        if (is_singular($dslc_post_types)) {
            $template_ID = dslc_st_get_template_ID(get_the_ID());
            if ($template_ID) {
                // Get template code
                if (dslc_is_editor_active() && get_post_meta($template_ID, 'dslc_code_draft', true)) {
                    $template_code = get_post_meta($template_ID, 'dslc_code_draft', true);
                } else {
                    $template_code = get_post_meta($template_ID, 'dslc_code', true);
                }
                // Add the template code
                $composer_prepend .= do_shortcode($template_code);
            }
        }
        // If archive, load template
        if (is_archive() && !is_author() && !is_search()) {
            $template_ID = dslc_get_option(get_post_type(), 'dslc_plugin_options_archives');
            if ($template_ID) {
                // Get template code
                if (dslc_is_editor_active() && get_post_meta($template_ID, 'dslc_code_draft', true)) {
                    $template_code = get_post_meta($template_ID, 'dslc_code_draft', true);
                } else {
                    $template_code = get_post_meta($template_ID, 'dslc_code', true);
                }
                // Add the template code
                $composer_prepend .= do_shortcode($template_code);
            }
        }
        if (is_author()) {
            $template_ID = dslc_get_option('author', 'dslc_plugin_options_archives');
            if ($template_ID) {
                // Get template code
                $template_code = get_post_meta($template_ID, 'dslc_code', true);
                // Add the template code
                $composer_prepend .= do_shortcode($template_code);
            }
        }
        if (is_search()) {
            $template_ID = dslc_get_option('search_results', 'dslc_plugin_options_archives');
            if ($template_ID) {
                // Get template code
                if (dslc_is_editor_active() && get_post_meta($template_ID, 'dslc_code_draft', true)) {
                    $composer_code = get_post_meta($template_ID, 'dslc_code_draft', true);
                } else {
                    $composer_code = get_post_meta($template_ID, 'dslc_code', true);
                }
            }
        }
        if (is_404()) {
            $template_ID = dslc_get_option('404_page', 'dslc_plugin_options_archives');
            if ($template_ID) {
                // Get template code
                if (dslc_is_editor_active() && get_post_meta($template_ID, 'dslc_code_draft', true)) {
                    $composer_code = get_post_meta($template_ID, 'dslc_code_draft', true);
                } else {
                    $composer_code = get_post_meta($template_ID, 'dslc_code', true);
                }
            }
        }
        if (!is_singular('dslc_hf')) {
            // Header/Footer
            if ($template_ID) {
                $header_footer = dslc_hf_get_ID($template_ID);
            } else {
                $header_footer = dslc_hf_get_ID(get_the_ID());
            }
            if ($dslc_active && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) {
                if ($header_footer['header']) {
                    $composer_header_append = '<div class="dslc-hf-block-overlay"><a target="_blank" href="' . add_query_arg('dslc', 'active', get_permalink($header_footer['header'])) . '" class="dslc-hf-block-overlay-button dslca-link">Edit Header</a></div>';
                }
                if ($header_footer['footer']) {
                    $composer_footer_append = '<div class="dslc-hf-block-overlay"><a target="_blank" href="' . add_query_arg('dslc', 'active', get_permalink($header_footer['footer'])) . '" class="dslc-hf-block-overlay-button dslca-link">Edit Footer</a></div>';
                }
            }
            // Header
            if ($header_footer['header']) {
                $header_code = get_post_meta($header_footer['header'], 'dslc_code', true);
                if (get_post_meta($header_footer['header'], 'dslc_hf_position', true)) {
                    $header_position = get_post_meta($header_footer['header'], 'dslc_hf_position', true);
                } else {
                    $header_position = 'relative';
                }
                $composer_header .= '<div id="dslc-header" class="dslc-header-pos-' . $header_position . '">' . do_shortcode($header_code) . $composer_header_append . '</div>';
            }
            // Footer
            if ($header_footer['footer']) {
                $footer_code = get_post_meta($header_footer['footer'], 'dslc_code', true);
                if (get_post_meta($header_footer['footer'], 'dslc_hf_position', true)) {
                    $footer_position = get_post_meta($header_footer['footer'], 'dslc_hf_position', true);
                } else {
                    $footer_position = 'relative';
                }
                $composer_footer .= '<div id="dslc-footer"  class="dslc-footer-pos-' . $footer_position . '">' . do_shortcode($footer_code) . $composer_footer_append . '</div>';
            }
        }
        // Content that shows before the composer content
        if ($dslc_active && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) {
            $composer_prepend = '';
        }
        // Content that shows after the composer content
        if ($dslc_active && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) {
            $editor_type = dslc_get_option('lc_editor_type', 'dslc_plugin_options_other');
            if (empty($editor_type)) {
                $editor_type = 'both';
            }
            $composer_append = '<div class="dslca-add-modules-section">
				<span class="dslca-add-modules-section-hook"><span class="dslca-icon dslc-icon-align-justify"></span>' . __('Add Modules Row', 'dslc_string') . '</span>
				<span class="dslca-import-modules-section-hook"><span class="dslca-icon dslc-icon-download-alt"></span>' . __('Import', 'dslc_string') . '</span>
			</div>';
            ob_start();
            ?>
				<div class="dslca-wp-editor">
					<div class="dslca-wp-editor-inner">
						<?php 
            if ($editor_type == 'visual') {
                wp_editor('', 'dslcawpeditor', array('quicktags' => false));
            } else {
                wp_editor('', 'dslcawpeditor');
            }
            ?>
						<div class="dslca-wp-editor-notification">
							<?php 
            _e('Module settings are being loaded. Save/Cancel actions will appear shortly.', 'dslc_string');
            ?>
						</div><!-- .dslca-wp-editor-notification -->
						<div class="dslca-wp-editor-actions">
							<span class="dslca-wp-editor-save-hook"><?php 
            _e('CONFIRM', 'dslc_string');
            ?>
</span>
							<span class="dslca-wp-editor-cancel-hook"><?php 
            _e('CANCEL', 'dslc_string');
            ?>
</span>
						</div>
					</div>
				</div>
			<?php 
            $composer_append .= ob_get_contents();
            ob_end_clean();
        }
        // If composer code not empty
        if ($composer_code || $template_code) {
            // Generate the composer output
            $composer_content = do_shortcode($composer_code);
        } elseif ($header_code || $footer_code) {
            if (!DS_LIVE_COMPOSER_ACTIVE) {
                return '<div id="dslc-content" class="dslc-content dslc-clearfix">' . $composer_header . '<div id="dslc-theme-content"><div id="dslc-theme-content-inner">' . $content . '</div></div>' . $composer_footer . '</div>';
            }
        } else {
            if (!DS_LIVE_COMPOSER_ACTIVE) {
                return '<div id="dslc-theme-content"><div id="dslc-theme-content-inner">' . $content . '</div></div>';
            }
        }
        // Post data
        if (is_singular() && has_post_thumbnail(get_the_ID())) {
            $composer_append .= '<input type="hidden" id="dslca-post-data-thumb" value="' . wp_get_attachment_url(get_post_thumbnail_id(get_the_ID())) . '" />';
        }
        // Tutorial page
        if ($tut_page) {
            $composer_append .= '<input type="hidden" id="dslca-tut-page" value="' . get_the_ID() . '" />';
        }
        // Regular textual content holder ( for search purposes )
        $content_for_search = '';
        if (get_post_meta(get_the_ID(), 'dslc_content_for_search', true)) {
            $content_for_search = get_post_meta(get_the_ID(), 'dslc_content_for_search', true);
        }
        if (DS_LIVE_COMPOSER_ACTIVE) {
            $composer_append .= '<textarea id="dslca-content-for-search">' . $content_for_search . '</textarea>';
        }
        // Return the composer output and the regular WYSIWYG output
        return '<div id="dslc-content" class="dslc-content dslc-clearfix">' . do_action('dslc_output_prepend') . $composer_header . '<div id="dslc-main">' . $composer_prepend . $composer_content . '</div>' . $composer_append . $composer_footer . do_action('dslc_output_append') . '</div>';
    } else {
        return '<div id="dslc-theme-content"><div id="dslc-theme-content-inner">' . $content . '</div></div>';
    }
}