Editar Header Twenty Ten (que no ocupe las imágenes destacadas)

  • Autor Autor Felipe
  • Fecha de inicio Fecha de inicio
Felipe

Felipe

Iota
Redactor
Verificación en dos pasos activada
Verificado por Whatsapp
Hola!
Resulta que me estoy dando el trabajo de hacer un theme hijo del twenty ten, pero me está ganando este tema.

Resulta que el theme trae la opción para modificar el header, pero cuando en un post hay una imagen destacada, reemplaza el header por la imagen destacada ¿Me entienden? (abajo está el código), lo que quiero es impedir que reemplace el header por la imagen destacada y que solo ocupe la imagen del header elegido desde el panel de opciones, pero la verdad... no logro hacerlo, alguien me pude ayudar a editar este código y que no verifique si hay imagen destacada, para que finalmente no la reemplace.

Insertar CODE, HTML o PHP:
				<?php
					// Compatibility with versions of WordPress prior to 3.4.
					if ( function_exists( 'get_custom_header' ) ) {
						/*
						 * We need to figure out what the minimum width should be for our featured image.
						 * This result would be the suggested width if the theme were to implement flexible widths.
						 */
						$header_image_width = get_theme_support( 'custom-header', 'width' );
					} else {
						$header_image_width = HEADER_IMAGE_WIDTH;
					}

					// Check if this is a post or page, if it has a thumbnail, and if it's a big one
					if ( is_singular() && current_theme_supports( 'post-thumbnails' ) &&
							has_post_thumbnail( $post->ID ) &&
							( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
							$image[1] >= $header_image_width ) :
						// Houston, we have a new header image!
						echo get_the_post_thumbnail( $post->ID );
					elseif ( get_header_image() ) :
						// Compatibility with versions of WordPress prior to 3.4.
						if ( function_exists( 'get_custom_header' ) ) {
							$header_image_width  = get_custom_header()->width;
							$header_image_height = get_custom_header()->height;
						} else {

							$header_image_width  = HEADER_IMAGE_WIDTH;
							$header_image_height = HEADER_IMAGE_HEIGHT;
						}
					?>

						<a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" title="<?php bloginfo( 'name' ); ?> | <?php bloginfo( 'description' ); ?>"/></a>
					<?php endif; ?>
 
[MENTION=9679]cicklow[/MENTION] si tiene tiempo, es tu hombre !
 
[MENTION=9679]cicklow[/MENTION] si tiene tiempo, es tu hombre !

Bueno, la verdad es que di con una solución:

Insertar CODE, HTML o PHP:
<?php
// Check to see if the header image has been removed
$header_image = get_header_image();
if ( ! empty( $header_image ) ) :
?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" title="<?php bloginfo( 'name' ); ?> | <?php bloginfo( 'description' ); ?>"/>

</a>
<?php endif; // end check for removed header image ?>

aunque este código no respeta las medidas del header cuando uno lo recorta, pero me sirve igual 🙂

Gracias de todas formas! 😉
 
Atrás
Arriba