Ejemplo n.º 1
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;
    }
}
/**
 * Creates a tab for pages and different post types
 */
function dslc_tab_content($content)
{
    if (get_post_type(get_the_ID()) == 'page' && is_admin()) {
        $url = DSLC_EditorInterface::get_editor_link(get_the_ID());
        ?>
		<div id="lc_content_wrap">
				<h2> <?php 
        _e('Edit this page in Live Composer', 'live-composer-page-builder');
        ?>
</h2>
				<div class="description"><?php 
        _e('Page builder stores content in a compressed way <br>(better for speed, security and user experience)', 'live-composer-page-builder');
        ?>
</div>
				<p><a class="button button-primary button-hero" target="_blank" href="<?php 
        echo $url;
        ?>
"><?php 
        echo __('Open in Live Composer', 'live-composer-page-builder');
        ?>
</a></p>
		</div>
	<?php 
    }
    return $content;
}