Exemple #1
0
 function wpex_page_header_css($output)
 {
     // Get post ID
     $post_id = wpex_get_the_id();
     // Return if ID not defined
     if (!$post_id) {
         return $output;
     }
     // Define var
     $css = $bg_img = '';
     $title_style = wpex_page_header_style($post_id);
     // Background Color
     if ($title_style == 'solid-color' || $title_style == 'background-image') {
         $bg_color = get_post_meta($post_id, 'wpex_post_title_background_color', true);
         if ($bg_color) {
             $css .= 'background-color: ' . $bg_color . ';';
         }
     }
     // Background image
     if ($title_style == 'background-image') {
         $bg_img = wpex_page_header_background_image($post_id);
         if ($bg_img) {
             $css .= 'background-image: url(' . $bg_img . ');background-position:50% 0;-webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;background-size: cover;';
         }
     }
     // Custom height
     $title_height = get_post_meta($post_id, 'wpex_post_title_height', true);
     if ($title_height) {
         $title_height = $title_height;
     } else {
         $title_height = '400';
     }
     if ($title_height && $bg_img) {
         $css .= 'height:' . intval($title_height) . 'px;';
     }
     // Apply all css to the page-header class
     if ('' != $css) {
         $output .= '.page-header { ' . $css . ' }';
     }
     // Overlay Color
     $overlay_color = get_post_meta($post_id, 'wpex_post_title_background_overlay', true);
     if ('bg_color' == $overlay_color && $title_style == 'background-image' && isset($bg_color)) {
         $output .= '.background-image-page-header-overlay { background-color: ' . $bg_color . '; }';
     }
     // Return css
     return $output;
 }
Exemple #2
0
    return;
}
// Define main vars
$classes = '';
$post_id = wpex_get_the_id();
$display_title = true;
$display_breadcrumbs = true;
$display_breadcrumbs = apply_filters('wpex_page_header_breadcrumbs', $display_breadcrumbs);
// If title is empty return false
if (!wpex_page_title($post_id)) {
    return;
}
// Return if page header is disabled via custom field
if ($post_id) {
    // Get title style
    $title_style = wpex_page_header_style($post_id);
    // Return if page header is disabled and there isn't a page header background defined
    if ('on' == get_post_meta($post_id, 'wpex_disable_title', true) && 'background-image' != $title_style) {
        return;
    }
    // Custom Classes
    if ($title_style) {
        $classes .= ' ' . $title_style . '-page-header';
    }
    // Disable title if the page header is disabled but the page header background is defined
    if ('on' == get_post_meta($post_id, 'wpex_disable_title', true) && 'background-image' == $title_style) {
        $display_title = false;
    }
}
// Before Hook
wpex_hook_page_header_before();