Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Removing big images from custom twenty eleven theme WordPress

Hi Guys

I want to know how to get rid of the large images on certain pages

Example:

http://www.terrapinpeakbbb.com/lodge.html

It is set as a featured image and when i remove it is replace by a default image.

I want to be able to remove the default image and space it is sitting in

How do i find how to do that.

Thanks
Steve

Answers (5)

2013-08-07

Navjot Singh answers:

Can you post the contents of the page template?


Steve Watson comments:

I'm not sure which template to show you as the theme is a customised child theme of twenty eleven

see this video: http://screencast.com/t/hjR2XVVsY0


Navjot Singh comments:

content-page.php


Steve Watson comments:

<?php
/**
* The template used for displaying page content in page.php
*
* @package WordPress
* @subpackage Twenty_Eleven
* @since Twenty Eleven 1.0
*/
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<div class="entry-title"><?php the_title(); ?></div>
</header><!-- .entry-header -->

<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<footer class="entry-meta">
<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-meta -->
</article><!-- #post-<?php the_ID(); ?> -->


Steve Watson comments:

The header.php looks like it might have the content...


Navjot Singh comments:

Sorry. Its the header.php.

2013-08-07

Remy answers:

In the template file, You can replace the code by something like that where the featured image is displayed :

if ( has_post_thumbnail() ) {
the_post_thumbnail();
}


but we need to see the full page template code to do it well


Steve Watson comments:

http://screencast.com/t/hjR2XVVsY0


Remy comments:

It's in the header.php, you need to remove this code block
else { <?php
<img src="/wp-content/uploads/blog.jpg" width="HEADER_IMAGE_WIDTH" height="HEADER_IMAGE_HEIGHT">
<?php }


beware to keep the } before the else, so you don't break the code.

2013-08-07

zebra webdesigns answers:

Hello Steve open the header.php file
and find the line for header_image();

Remove the entire line.
But you need to be careful regarding this. since it will remove the header image in all pages.
optionally you can specify the page where you might need this has to be loaded by using the conditional tags.

http://codex.wordpress.org/Conditional_Tags

eg:
<?php if ( is_page(2)) { ?>
<img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
<?php } ?>

where 2 is the id of the page


zebra webdesigns comments:

Hi Steve
As I mentioned before its in the header.php file

Take a look at it :)


Steve Watson comments:

This is the part of the header.php file that is about the header can you show me what to remove?

// Check to see if the header image has been removed
$header_image = get_header_image();
if ( ! empty( $header_image ) ) :
// The header image
// Check if this is a post or page, if it has a thumbnail, and if it's a big one
if ( is_singular() &&
has_post_thumbnail( $post->ID ) &&
( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( HEADER_IMAGE_WIDTH, HEADER_IMAGE_WIDTH ) ) ) &&
$image[1] >= HEADER_IMAGE_WIDTH )
{
// Houston, we have a new header image!
if(is_page(2))
{
echo('<div style="float:left;">' . do_shortcode('') . '</div>');?><div style="height:7px;"></div><?php
}

else
{
echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
}
}else{ ?>
<img src="/wp-content/uploads/blog.jpg" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt=""/>
<?php } // end check for featured image or standard header ?>
<?php endif; // end check for removed header image ?>

<?php
if ( is_singular() && has_post_thumbnail( $post->ID ))
{
// Has the text been hidden?
if ( 'blank' == get_header_textcolor() ) :
?>
<div class="only-search<?php if ( ! empty( $header_image ) ) : ?> with-image<?php endif; ?>">
</div>
<?php endif;
} ?>

</header>


Steve Watson comments:

is it this part i need to comment out

$header_image = get_header_image();

like this

//$header_image = get_header_image();


zebra webdesigns comments:

Hello steve Remove the following lines you will be fine.

else{ ?>
<img src="/wp-content/uploads/blog.jpg" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt=""/>
<?php } // end check for featured image or standard header ?>


Steve Watson comments:

For some reason it is now showing a server error. Would that be to do with the change i just made or a coincedence?

http://www.terrapinpeakbbb.com/


Steve Watson comments:

Can you check this for me please, attached is the header.php file


zebra webdesigns comments:

Hello Steve.
Can you check the htaccess file.
your backend is logging in .
SO it should be the htaccess.
just go to settings -> permalinks
and try to save it


Steve Watson comments:

Its ok i fixed it... i messed up the header.php


zebra webdesigns comments:

Thats great. Please take a full backup of the site, if it is not and try to cross check for all the changes made.

2013-08-07

Joshua Nelson answers:

Steve,

It is in the custom code of header.php. It looks like they already wrote it in to check if the $header_image is empty, then it displays the image attached to that page. Are you sure that page doesn't have a featured image or imaged attached to it for the header? It would probably be somewhere in the settings for that page (Page > Edit), or you could look through your Media library and find it, remove the association there.


Joshua Nelson comments:

Remy got it, change this:

else { <?php

<img src="/wp-content/uploads/blog.jpg" width="HEADER_IMAGE_WIDTH" height="HEADER_IMAGE_HEIGHT">

<?php }


to this:

}

2013-08-07

Sabby Sam answers:

Hi Steve,
As said by Joshua Nelson do this.
He is right, replace the below code
$header_image = get_header_image();
if ( ! empty( $header_image ) ) :
// The header image
// Check if this is a post or page, if it has a thumbnail, and if it's a big one
if ( is_singular() &&
has_post_thumbnail( $post->ID ) &&
( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( HEADER_IMAGE_WIDTH, HEADER_IMAGE_WIDTH ) ) ) &&
$image[1] >= HEADER_IMAGE_WIDTH )
{
// Houston, we have a new header image!
if(is_page(2))
{
echo('<div style="float:left;">' . do_shortcode('') . '</div>');?><div style="height:7px;"></div><?php
}

else
{
echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
}
}else{ ?>

<?php } // end check for featured image or standard header ?>
<?php endif; // end check for removed header image ?>

<?php
if ( is_singular() && has_post_thumbnail( $post->ID ))
{
// Has the text been hidden?
if ( 'blank' == get_header_textcolor() ) :
?>
<div class="only-search<?php if ( ! empty( $header_image ) ) : ?> with-image<?php endif; ?>">
</div>
<?php endif;
} ?>

</header>