Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Display Featured Header Image div
- *
- * @since NepalBuzz 0.1
- */
- function nepalbuzz_header_div() {
- $status = nepalbuzz_header_media_status();
- if ( $status ) {
- global $post;
- $header_image = nepalbuzz_featured_image();
- $options = nepalbuzz_get_options();
- $title = $options['featured_header_title'];
- $content = $options['featured_header_content'];
- $button_text = $options['featured_header_button_text'];
- $button_link = $options['featured_header_button_link'];
- $button_target = $options['featured_header_button_target'];
- $enable_header_image = $options['enable_featured_header_image'];
- if ( is_page() || is_single() ) {
- //Individual Page/Post Image Setting
- $individual_featured_image = get_post_meta( $post->ID, 'nepalbuzz-header-image', true );
- if ( 'disable' == $individual_featured_image || ( 'default' == $individual_featured_image && 'disable' == $enable_header_image ) ) {
- echo '<!-- Page/Post Disable Header Image -->';
- return false;
- }
- }
- $button_target_value = '_self';
- if ( $button_target ) {
- $button_target_value = '_blank';
- }
- $classes = array();
- $default_image = get_template_directory_uri() . '/images/header-1920x1080.jpg';
- if ( function_exists( 'get_parent_theme_file_uri' ) ) {
- $default_image = get_parent_theme_file_uri( '/images/header-1920x1080.jpg' );
- }
- echo '<div class="custom-header">';
- if ( 'video' == $header_image ) {
- $classes[] = 'video';
- } else if ( $default_image == $header_image ) {
- $classes[] = 'default';
- }
- if ( has_custom_header() ) {
- echo '<div class="custom-header-media">';
- the_custom_header_markup();
- echo '</div>';
- }
- echo '
- <div class="custom-header-content ' . esc_attr( implode( ' ', $classes ) ) . '">
- <article class="hentry header-image">
- <div class="entry-container">';
- if ( '' != $title ) {
- echo '
- <header class="entry-header">
- <h2 class="entry-title">
- <a href="' . esc_url( $button_link ) . '" target="' . esc_attr( $button_target_value ) . '">' . wp_kses_post( $title ) . '</a>
- </h2>
- </header>';
- }
- if ( '' != $content || '' != $button_text ) {
- echo '
- <div class="entry-content"><p>
- ' . $content;
- if ( '' != $button_text ) {
- echo '<span class="more-button"><a class="more-link" href="' . esc_url( $button_link ) . '" target="' . esc_attr( $button_target_value ) . '">'. esc_html( $button_text ) .'</a></span>';
- }
- echo '</p></div>';
- }
- echo '
- </div><!-- .entry-container -->
- </article><!-- .hentry.header-image -->
- </div><!-- #header-featured-image -->
- </div><!-- .custom-header -->';
- }
- } // nepalbuzz_header_div
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement