Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ( is_front_page() )
- {
- if ( get_header_image() )
- {
- // So, so good!
- $custom_header_attachment_id = get_custom_header()->attachment_id;
- $custom_header_image_alt = trim( strip_tags( get_post_meta(
- $custom_header_attachment_id,
- '_wp_attachment_image_alt',
- true
- ) ) );
- ?>
- <div class="header__featured-image-container">
- <?php
- $args = [
- // 'class' => 'header__featured-image',
- // 'alt' => $custom_header_image_alt
- ];
- echo get_header_image_tag( $args );
- ?>
- </div>
- <?php
- }
- }
- ?>
- <?php
- function ivana_custom_header_setup()
- {
- add_theme_support( 'custom-header', apply_filters( 'ivana_custom_header_args', [
- 'default-image' => '',
- 'default-text-color' => '000',
- 'width' => '1000',
- 'height' => '250',
- 'flex-width' => true,
- 'flex-height' => true,
- 'wp-head-callback' => 'ivana_header_style'
- ] ) );
- }
- add_action( 'after_setup_theme', 'ivana_custom_header_setup' );
- function ivana_header_style()
- {
- $header_text_color = get_header_textcolor();
- if ( get_theme_support( 'custom-header', 'default-text-color' ) )
- {
- ?>
- <style type="text/css">
- <?php
- if ( ! display_header_text() )
- {
- ?>
- .site-title,
- .site-description {
- position: absolute;
- /* This is a nice approach, haven't thought about it! */
- clip: rect(1px, 1px, 1px, 1px);
- }
- <?php
- }
- else
- {
- ?>
- .site-title a,
- .site-description {
- color: <?php echo esc_attr( $header_text_color ); ?>;
- }
- <?php } ?>
- </style>
- <?php
- }
- }
Add Comment
Please, Sign In to add comment