I am looking to have a diffrent slide show in the header on diffrent pages. Can this be done.
Many Thanks
Cheers
David
I am looking to have a diffrent slide show in the header on diffrent pages. Can this be done.
Many Thanks
Cheers
David
I have tried creating another header and adding the code into the new header, plus added some code to the "main index page" but looks like I have done something wrong.
See code added to Main Index Page:
<?php
if ( is_Home() ) :
get_header();
elseif ( is_Outdoor Market() ) :
get_header('outdoor_market');
else :
get_header();
endif;
?>
Many Thanks
Cheers
David
That should work, but make sure that the conditional tags are correct, keep in mind that they are case-sensitive. if the only thing that is changing in these headers is the slideshow, I'd consider using just one header and loading the slideshow conditionally within that header like this:
<?php if ( is_home() ) {
if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow( "home", "" ); }
} elseif ( is_page( 'outdoor-market' ) ) {
if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow( "outdoor-market", "" ); }
} else {
if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow( "default", "" ); }
} ?>
That code assumes that the homepage is defaulting to the blog, if you're using a static homepage you'll need to use is_front_page instead.
JLeuze,
Many Thanks - looks like I have done something wrong - I now get this error:
Parse error: syntax error, unexpected $end in /home/feein/public_html/wp-content/themes/Twentyeleven-child/header.php on line 140
Cheers
David
No problem David, can you put the contents of your header.php file on Pastebin so I can take a look?
I think that now in the pastebin - Many thanks for your help -
I will also drop a copy below:
Cheers
David
----------------
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="main">
*
* @package WordPress
* @subpackage Twenty_Eleven
* @since Twenty Eleven 1.0
*/
?><!DOCTYPE html>
<!--[if IE 6]>
<html id="ie6" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 7]>
<html id="ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html id="ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width" />
<title><?php
/*
* Print the <title> tag based on what is being viewed.
*/
global $page, $paged;
wp_title( '|', true, 'right' );
// Add the blog name.
bloginfo( 'name' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
echo " | $site_description";
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) );
?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php
/* We add some JavaScript to pages with the comment form
* to support sites with threaded comments (when in use).
*/
if ( is_singular() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
/* Always have wp_head() just before the closing </head>
* tag of your theme, or you will break many plugins, which
* generally use this hook to add elements to <head> such
* as styles, scripts, and meta tags.
*/
wp_head();
?>
</head>
<body <?php body_class(); ?>>
<div id="page" class="hfeed">
<header id="branding" role="banner">
<hgroup>
<h1 id="site-title"><span>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></span></h1>
<h2 id="site-description"><?php bloginfo( 'description' ); ?></h2>
</hgroup>
<?php
// Check to see if the header image has been removed
$header_image = get_header_image();
if ( ! empty( $header_image ) ) :
?>
">
<?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 : ?>
<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
<?php endif; // end check for featured image or standard header ?>
<?php endif; // end check for removed header image ?>
<?php
// Has the text been hidden?
if ( 'blank' == get_header_textcolor() ) :
?>
<div class="only-search<?php if ( ! empty( $header_image ) ) : ?> with-image<?php endif; ?>">
<?php get_search_form(); ?>
</div>
<?php
else :
?>
<?php get_search_form(); ?>
<?php endif; ?>
<nav id="access" role="navigation">
<h3 class="assistive-text"><?php _e( 'Main menu', 'twentyeleven' ); ?></h3>
<?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. */ ?>
<div class="skip-link">"><?php _e( 'Skip to primary content', 'twentyeleven' ); ?></div>
<div class="skip-link">"><?php _e( 'Skip to secondary content', 'twentyeleven' ); ?></div>
<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav><!-- #access -->
</header><!-- #branding -->
<div id="main">
No, you have to use pastebin.com for more than 10 lines of code and add a link here, otherwise the mods will delete the code from your post.
Something must be formatted incorrectly, there isn't a line 140, I don't see those conditionals or the slideshow tag in here.
Sorry - will not do more than 10 line in the futur@
See link below:
Many Thanks
Cheers
David
No problem, thanks for adding that, the problem was that part of the code to load the featured header images was missing. It looks like you are trying to replace the header image with a slideshow, so I removed that featured image code entirely and it works now: http://pastebin.com/yUfQ0nyf
Thanks for your help - not sure if I have done something wrong, I copied the data from the past bin, and replace the info in the header file, but now have no header at all?
Sorry for the hassle
Many Thanks
Cheers
David
Make sure you are copying the "RAW Paste Data" at the bottom, the first copy could have some formatting issues.
Thanks for the suggestion, but I did copy the "Raw Past Data"
Cheers
David
Try replacing the header with a fresh copy from TwentyEleven and make sure you can get it working again with the default code and then give it another shot :)
You must log in to post.