Danke. Ich verwende ein Child Theme.
In der ursprünglichen header.php ist ein ziemlich langer Code dafür zuständig, das header-Bild zu zeigen:
________________________________________________
<?php
// Check to see if the header image has been removed
$header_image = get_header_image();
if ( $header_image ) :
// 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;
}
?>
<a>">
<?php
/*
* 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!
echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
else :
// 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;
}
?>
<img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" />
<?php endif; // end check for featured image or standard header ?>
</a>
<?php endif; // end check for removed header image ?>
———————————————————-
Wenn ich diesen Block ersetzte durch:
<?php if(is_front_page()) { easingslider( 180 ); } ?>
erscheint auf der Startseite im Header der Slider, aber auf den anderen Seiten nichts. Wie bekomme ich es hin, dass auf den anderen Seiten das normale header-Bild erscheint? Sicher etwas mit „if else“, aber wie genau?
Danke!
[Code bitte auch immer als Code auszeichen! Danke. – Torsten]
Sicher etwas mit „if else“, aber wie genau?
http://php.net/manual/de/control-structures.elseif.php
Gruß, Torsten
Danke, aber das meinte ich nicht. Ich habe mich falsch ausgedrückt. Ich brauche eine einfache if(…){…} else{…} Konstruktion.
IF (Wenn es sich um die Frontpage handelt) {Slider zeigen}
ELSE {normales Headerbild zeigen}
Den if-Teil habe ich schon, und er funktioniert auch. Mein Problem ist, wie ich den umfangreichen Code, der das Headerbild beschreibt (siehe oben) in den else-Teil packen kann.
Genau so, wie du es schreibst:
if {
// code für if-Fall
} else {
// code für else-Fall
}
Gruß, Torsten
Mijn Deutsch is nicht gut but I have the very same problem, I believe. My header shows up on my homepage but my header for my posts don’t show up, even though I’ve specified them. This is something new and I don’t know how to solve it. For example, on http://78mph.com/2015/10/wintergreen-golf-and-country-club/ you should see a lovely green golf course behind where a lady is standing, and you don’t get that; just the rotational banners I’ve set up. Your help would be great.
@thehockeymom: Please use the english forums if you want support in English:
https://wordpress.org/support/
And *always* start a new thread for your question. Thank you.
All the best,
Torsten