Example #1
0
function draw_post_header($title = '', $excerpt = '', $bg = '', $size = 'full', $parallax = 'off')
{
    ////KC::debug(wp_get_attachment_image_src(get_post_thumbnail_id(1480), 'full'));
    $title = get_post_title($title);
    $excerpt = get_post_excerpt($excerpt);
    $bg = get_post_bg($bg, $size);
    $classes = "draw-post-header";
    if ($bg == KC::$default_header_image) {
        $classes .= " default-bg";
        $parallax = "off";
    }
    // possibly set these from custom post types
    //$parallax = "off"; // on/off
    $title = "<h2><span>{$title}</span></h2>";
    if ($excerpt) {
        $excerpt = "<h3><span>{$excerpt}</span></h3>";
    }
    KC::debug($excerpt);
    $content = <<<EOT
    [et_pb_section admin_label="section" background_image="{$bg}" transparent_background="on" allow_player_pause="off" inner_shadow="off" parallax="{$parallax}" parallax_method="true"
\t\tcustom_padding="" padding_mobile="on" make_fullwidth="off" use_custom_width="off" width_unit="on" make_equal="off" use_custom_gutter="off"]

\t[et_pb_row admin_label="row" make_fullwidth="off" use_custom_width="off" width_unit="off" custom_width_percent="" use_custom_gutter="off"
\t    padding_mobile="off" allow_player_pause="off" parallax="on" parallax_method="off" make_equal="off" column_padding_mobile="on"]

\t    [et_pb_column type="4_4"]

\t\t[et_pb_cta admin_label="Call To Action" title="" url_new_window="off" use_background_color="on" background_color="" background_layout="" text_orientation=""
\t\t\tcustom_margin="" custom_padding="" custom_button="off" button_letter_spacing="0" button_use_icon="default" button_icon_placement="right" button_on_hover="on" button_letter_spacing_hover="0"]
\t\t    {$title}
\t\t    {$excerpt}
\t\t[/et_pb_cta]
\t    [/et_pb_column]
\t[/et_pb_row]
    [/et_pb_section]
EOT;
    echo '<div class="' . $classes . '">' . do_shortcode($content) . '</div>';
}
/**
 * @param type $title - 'text', title, author
 * @param type $excerpt - 'text', excerpt
 * @param type $bg - 'url', featured, author
 * @param type $size - '', full
 * @param type $parallax - '', css, js
 * @param type $height - '', full
 */
function draw_post_header($title, $excerpt, $bg, $size, $parallax, $height)
{
    $title = get_post_title($title);
    $excerpt = get_post_excerpt($excerpt);
    $bg = get_post_bg($bg, $size);
    $classes = 'draw-post-header';
    if ($bg == KC::$default_header_image) {
        $classes .= ' default-bg';
    }
    //$parallax = 'js';
    if ($parallax === 'css') {
        $parallax = 'on';
        $parallax_method = 'off';
    } elseif ($parallax === 'js' || $parallax === 'on') {
        $parallax = 'on';
        $parallax_method = 'on';
    } else {
        $parallax = 'off';
        $parallax_method = 'off';
    }
    $classes .= ' parallax-' . $parallax;
    $classes .= ' parallax-method-' . $parallax_method;
    if ($title) {
        $title = "<h2><span>{$title}</span></h2>";
    }
    if ($excerpt) {
        $excerpt = "<h3><span>{$excerpt}</span></h3>";
    }
    //    if (true || $height === 'full') {
    $classes .= " height-full";
    $header_fullscreen = $height === 'full' ? 'on' : 'off';
    $text_orientation = 'center';
    // left center right
    $content_orientation = 'center';
    // top center bottom
    $content = <<<EOT
        [et_pb_section admin_label="section" background_image="{$bg}" transparent_background="on" inner_shadow="on" parallax="{$parallax}" parallax_method="{$parallax_method}" module_id=""
            fullwidth="on" specialty="off"]

        [et_pb_fullwidth_header admin_label="Fullwidth Header" background_layout="dark" text_orientation="{$text_orientation}" header_fullscreen="{$header_fullscreen}" 
            header_scroll_down="off" scroll_down_icon="%%0%%" parallax="" parallax_method="" 
            content_orientation="{$content_orientation}" image_orientation="center" custom_button_one="off" button_one_letter_spacing="0" button_one_use_icon="default" button_one_icon_placement="right" button_one_on_hover="on" button_one_letter_spacing_hover="0" 
            custom_button_two="off" button_two_letter_spacing="0" button_two_use_icon="default" button_two_icon_placement="right" button_two_on_hover="on" button_two_letter_spacing_hover="0" button_one_text="" 
            button_one_text_size="20" button_one_border_width="2" button_one_border_radius="50" button_one_border_radius_hover="3" button_two_text_size="20" button_two_border_width="2" button_two_border_radius="50" button_two_border_radius_hover="3"
            background_url="" background_overlay_color="rgba(0,0,0,0)" 
            logo_image_url="" logo_alt_text="" logo_title="" title="" button_one_url=""]
        {$title}
        {$excerpt}
        [/et_pb_fullwidth_header]
        [/et_pb_section]
EOT;
    //    }
    //    else {
    //        $classes .= " height-default";
    //        $content = <<<EOT
    //        [et_pb_section admin_label="section" background_image="$bg" transparent_background="on" allow_player_pause="off" inner_shadow="off"
    //            parallax="$parallax" parallax_method="$parallax_method"
    //            custom_padding="" padding_mobile="on" make_fullwidth="off" use_custom_width="off" width_unit="on" make_equal="off" use_custom_gutter="off"]
    //
    //            [et_pb_row admin_label="row" make_fullwidth="off" use_custom_width="off" width_unit="off" custom_width_percent="" use_custom_gutter="off"
    //                padding_mobile="off" allow_player_pause="off" parallax="on" parallax_method="off" make_equal="off" column_padding_mobile="on"]
    //
    //                [et_pb_column type="4_4"]
    //
    //                    [et_pb_cta admin_label="Call To Action" title="" url_new_window="off" use_background_color="on" background_color="" background_layout="" text_orientation=""
    //                            custom_margin="" custom_padding="" custom_button="off" button_letter_spacing="0" button_use_icon="default" button_icon_placement="right" button_on_hover="on" button_letter_spacing_hover="0"]
    //                        $title
    //                        $excerpt
    //                    [/et_pb_cta]
    //                [/et_pb_column]
    //            [/et_pb_row]
    //        [/et_pb_section]
    //EOT;
    //    }
    echo '<div class="' . $classes . '">' . do_shortcode($content) . '</div>';
}