How do you make a Wordpress header image clickable so that it navigates to the the home page.
Here is my header.php file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<title><?php
if ( is_single() ) { single_post_title(); }
elseif ( is_home() || is_front_page() ) { bloginfo('name'); print ' | '; bloginfo('description'); get_page_number(); }
elseif ( is_page() ) { single_post_title(''); }
elseif ( is_search() ) { bloginfo('name'); print ' | Search results for ' . wp_specialchars($s); get_page_number(); }
elseif ( is_404() ) { bloginfo('name'); print ' | Not Found'; }
else { bloginfo('name'); wp_title('|'); get_page_number(); }
?></title>
<meta http-equiv="content-type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" />
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>
<link rel="alternate" type="application/rss+xml" href="<?php bloginfo('rss2_url'); ?>" title="<?php printf( __( '%s latest posts', 'your-theme' ), wp_specialchars( get_bloginfo('name'), 1 ) ); ?>" />
<link rel="alternate" type="application/rss+xml" href="<?php bloginfo('comments_rss2_url') ?>" title="<?php printf( __( '%s latest comments', 'your-theme' ), wp_specialchars( get_bloginfo('name'), 1 ) ); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
</head>
<body>
<div id="wrapper" class="hfeed">
<div id="header">
<div id="masthead">
<div id="branding">
</a></span></div>
<?php if ( is_home() || is_front_page() ) { ?>
<?php } else { ?>
<?php } ?>
</div><!– #branding –>
<div id="access">
</div><!– #access –>
</div><!– #masthead –>
</div><!– #header –>
<div id="main">
Thanks for any help!
To whichever div you want to be clickable, add onclick="window.location.href='/'". You'll want to style it so it has cursor:pointer too, so people will know it's a link.
<img src="<?php bloginfo('stylesheet_directory'); ?>/header.png">
Related
Regarding my sidebar widget on WordPress. I would like it to load like this all in one column after the main content on mobile devices, which I had before but not sure what caused it to go wrong. Image of previous correct loading
Its also loading incorrectly on desktop post pages too.
The page I need help with.
Seems like there is something I have or that is missing in my child theme's header.php that is causing my right sidebar widgets to load wrong.
I am using the Twenty Eleven theme. Below is code for my current LIVE header.php
<?php
/**
* Header template for the 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();
?>
<script type="text/javascript"> //<![CDATA[
var tlJsHost = ((window.location.protocol == "https:") ? "https://secure.comodo.com/" : "http://www.trustlogo.com/");
document.write(unescape("%3Cscript src='" + tlJsHost + "trustlogo/javascript/trustlogo.js' type='text/javascript'%3E%3C/script%3E"));
//]]>
</script>
</head>
<body <?php body_class(); ?>>
<div id="page" class="hfeed">
<header id="branding" role="banner">
<hgroup>
<h1 id="site-title"><span><?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 ( $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 href="<?php echo esc_url( home_url( '/' ) ); ?>">
<?php
// 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="" />
</a>
<?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 ( $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"><a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to primary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to primary content', 'twentyeleven' ); ?></a></div>
<div class="skip-link"><a class="assistive-text" href="#secondary" title="<?php esc_attr_e( 'Skip to secondary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to secondary content', 'twentyeleven' ); ?></a></div>
<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assigned to the primary location is the one used. If one isn't assigned, the menu with the lowest ID is used. */ ?>
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav><!-- #access -->
</header><!-- #branding -->
</body>
When I replace it with the parent themes default header.php script (below) the problem with the right sidebar orientation gets fixed but then for some reason my sites header logo gets switched to the featured image so it inherits a different problem.
Below is the parent theme's header.php script
<?php
/**
* Header template for the 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 ) && ! is_404() ) {
/* translators: %s: Page number. */
echo esc_html( ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) ) );
}
?>
</title>
<link rel="profile" href="https://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>?ver=20190507" />
<link rel="pingback" href="<?php echo esc_url( get_bloginfo( 'pingback_url' ) ); ?>">
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js?ver=3.7.0" 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(); ?>>
<?php wp_body_open(); ?>
<div id="page" class="hfeed">
<header id="branding">
<hgroup>
<h1 id="site-title"><span><?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 ( $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 href="<?php echo esc_url( home_url( '/' ) ); ?>">
<?php
/*
* The header image.
* Check if this is a post or page, if it has a thumbnail, and if it's a big one
*/
$image = false;
if ( is_singular() && has_post_thumbnail( $post->ID ) ) {
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) );
}
if ( $image && $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 esc_attr( $header_image_width ); ?>" height="<?php echo esc_attr( $header_image_height ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" />
<?php
} // End check for featured image or standard header.
?>
</a>
<?php endif; // End check for removed header image. ?>
<?php
// Has the text been hidden?
if ( 'blank' === get_header_textcolor() ) :
$header_image_class = '';
if ( $header_image ) {
$header_image_class = ' with-image';
}
?>
<div class="only-search<?php echo $header_image_class; ?>">
<?php get_search_form(); ?>
</div>
<?php
else :
?>
<?php get_search_form(); ?>
<?php endif; ?>
<nav id="access">
<h3 class="assistive-text"><?php _e( 'Main menu', 'twentyeleven' ); ?></h3>
<?php
/*
* Our navigation menu. If one isn't filled out, wp_nav_menu() falls back to wp_page_menu().
* The menu assigned to the primary location is the one used.
* If one isn't assigned, the menu with the lowest ID is used.
*/
wp_nav_menu( array( 'theme_location' => 'primary' ) );
?>
</nav><!-- #access -->
</header><!-- #branding -->
<div id="main">
Seems that my current child theme's header.php on single posts orients the right sidebar to load all the way to the right and in its own awkward column after the main content and this does not look right.
Image of current incorrect loading
I would like it to load this way all in one column after the main content, which I had before but not sure what caused it to go wrong. Image of previous correct load
Need helping fixing this. Any help would be greatly appreciated! Thank you
For some reason my contact form is showing up above my wordpress header as shown below:
Here is my code:
<?php
/**
* Template Name: Contact Us
*
* #package WordPress
* #subpackage Creativeforces
* #since Creativeforces Group 1.0
*/
?>
<head>
<meta charset="utf-8">
<title>Creative Forces | Contact Us</title>
<link rel="stylesheet" type="text/css" href="/wp-content/themes/creativeforces/css/contact.css">
<link href='https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700' rel='stylesheet' type='text/css'>
</head>
<header>
<?php while ( have_posts() ) : the_post() ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php get_sidebar(); ?>
</header>
<?php get_header(); ?>
<?php get_footer(); ?>
and on the contact page in wordpress admin I have the shortcode:
[contact-form-7 id="131" title="Contact form 1"]
here is header.php id needed:
<?php
/**
* The template for displaying the header
*
* Displays all of the head element and everything up until the "site-content" div.
*
* #package WordPress
* #subpackage Creativeforces
* #since Creativeforces 1.0
*/
?>
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="content-type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<?php wp_head(); ?>
<link rel="alternate" type="application/rss+xml" href="<?php bloginfo('rss2_url'); ?>" title="<?php printf( __( '%s latest posts', 'your-theme' ), wp_specialchars( get_bloginfo('name'), 1 ) ); ?>" />
<link rel="alternate" type="application/rss+xml" href="<?php bloginfo('comments_rss2_url') ?>" title="<?php printf( __( '%s latest comments', 'your-theme' ), wp_specialchars( get_bloginfo('name'), 1 ) ); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
</head>
<body data-spy="scroll" data-target=".navbar">
<div class="black-line"></div>
<!-- LOGO -->
<?php if ( get_theme_mod( 'themeslug_logo' ) ) : ?>
<div class='site-logo'>
<a href='<?php echo esc_url( home_url( '/' ) ); ?>' title='<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>' rel='home'><img src='<?php echo esc_url( get_theme_mod( 'themeslug_logo' ) ); ?>' alt='<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>'></a>
</div>
<?php else : ?>
<!-- Displayes blog title and description -->
<hgroup>
<h1 class='site-title'><a href='<?php echo esc_url( home_url( '/' ) ); ?>' title='<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>' rel='home'><?php bloginfo( 'name' ); ?></a></h1>
<h2 class='site-description'><?php bloginfo( 'description' ); ?></h2>
</hgroup>
<?php endif; ?>
<!-- Top-Nav-Menu -->
<div id="menu" class="navbar text-center">
<?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu-header', 'container' => 'nav', 'theme_location' => 'header-menu', 'walker' => new wp_bootstrap_navwalker()) ); ?>
</div>
any help would be appreciated!
You have placed wp_header() after the the_content()
It should next to tag.
Generally It is like -
- header
- content
- footer
Here is the code after modification -
<?php
/**
* Template Name: Contact Us
*
* #package WordPress
* #subpackage Creativeforces
* #since Creativeforces Group 1.0
*/
?>
<head>
<meta charset="utf-8">
<title>Creative Forces | Contact Us</title>
<link rel="stylesheet" type="text/css" href="/wp-content/themes/creativeforces/css/contact.css">
<link href='https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700' rel='stylesheet' type='text/css'>
</head>
<body>
<header>
<?php get_header(); ?>
</header>
<?php while ( have_posts() ) : the_post() ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php get_sidebar(); ?>
<footer>
<?php get_footer(); ?>
</footer>
You are adding content/sidebar inside header section and after that this header has been added so that's the reason your contact form 7 is appearing above the header.
Please try like this
<header>
<?php get_header(); ?>
</header>
<div class="contentdiv">
<?php while ( have_posts() ) : the_post() ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php get_sidebar(); ?>
</div>
I am a beginner in WP. I want different logo in each page of word press site like for few page of the site i need different logo and different for other. i tried to use conditional statement but as i am beginner so my overall site crashes and have a blank screen. if there is some plugin that can achieve this kind of functionality it would be really a great help.
Can you guide me how to achieve it.
Here is my header.php code i tried to edit it but all in vain.
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width" />
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<meta name="viewport" content="initial-scale=1">
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/source/vendor/html5.js" type="text/javascript"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<header id="masthead" class="site-header" role="banner">
<div class="container">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home" class="site-branding">
<!--Editing start from here and i am gona delete all other code from above span section-->
<?php $header_image = get_header_image(); ?>
<h1 class="site-title">
<?php if ( ! empty( $header_image ) ) : ?>
<img src="<?php echo $header_image ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
<?php endif; ?>
<span><?php bloginfo( 'name' ); ?></span>
</h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</a>
<nav id="site-navigation" class="site-primary-navigation slide-left">
<i class="icon-cancel-circled"></i> <span><?php _e( 'Close', 'jobify' ); ?></span>
<?php get_search_form(); ?>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu-primary' ) ); ?>
</nav>
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<i class="icon-menu"></i>
<?php endif; ?>
</div>
</header><!-- #masthead -->
<div id="main" class="site-main">
Thanks
Try using something like this.
if(is_page('Blog')){ // the parameter used here is the post_title
echo '<img src="http://yourwebsite.com/path-to-your-image/blog-logo.png" />';
}elseif(is_page('home')){ // the parameter used here is the post slug
echo '<img src="http://yourwebsite.com/path-to-your-image/home-logo.png" />';
}elseif(is_page('42')){ // the parameter used here is the post id
echo '<img src="http://yourwebsite.com/path-to-your-image/other-logo.png" />';
}else{ // else display default logo
$header_image = get_header_image();
}
You can get more info here:
https://codex.wordpress.org/Function_Reference/is_page
Depending on the theme you are using, it's sometimes build-in feature!
I know Arcade Basic which has this custom header feature:
https://wordpress.org/themes/arcade-basic/
There are probably much more theme's which supports this feature by default, search on the 'featured-image-header' and 'flexible-header' tags on the Wordpress site to find more themes....
https://wordpress.org/themes/tags/featured-image-header/
https://wordpress.org/themes/tags/flexible-header/
And maybe 'custom-header' tag?
https://wordpress.org/themes/tags/custom-header/
Finally, there are indeed a lot of plugins, like "WP Header Images", more can be found here:
https://wordpress.org/plugins/search.php?q=header+image&sort=
Below is the PHP code of the WordPress traction theme. I want to show my keywords and description on every post/pages as shown on home page. How do I do this?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php if ( is_front_page() ) : ?>
<title><?php bloginfo( 'name' ); ?></title>
<meta name="description" content="<?php if ( is_single() ) {
single_post_title('', true);
} else {
bloginfo('name'); echo " - "; bloginfo('description');
}
?>" />
<meta name="keywords" content="mediafire, free movies, download movies, movies
mediafire, online movies, download mediafire movies, movies online, hindi movies,
bollywood movies, english movies, small movies, high quality, small size, free
download, download, download links" />
<meta http-equiv="author" content="M.Naeem Riaz" />
<?php elseif ( is_404() ) : ?>
<title><?php _e( 'Page Not Found |', 'traction' ); ?> | <?php bloginfo( 'name' );
?></title>
<?php elseif ( is_search() ) : ?>
<title><?php printf(__ ("Search results for '%s'", "traction"),
attribute_escape(get_search_query())); ?> | <?php bloginfo( 'name' ); ?></title>
<?php else : ?>
<title><?php wp_title($sep = '' ); ?> | <?php bloginfo( 'name' );?></title>
<?php endif; ?>
<!-- Basic Meta Data -->
<meta name="Copyright" content="Design is copyright <?php echo date( 'Y' ); ?> The
Theme Foundry" />
<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>;
charset=<?php bloginfo( 'charset' ); ?>" />
<?php if ((is_single() || is_category() || is_page() || is_home()) && (!is_paged())) :
else : ?>
<meta name="robots" content="noindex,follow" />
<?php endif; ?>
<!-- Favicon -->
<link rel="shortcut icon" href="<?php bloginfo( 'stylesheet_directory' ); ?>/images
/favicon.ico" />
<!--Stylesheets-->
<?php if ( ($traction->colorScheme() != 'default' ) ) { ?>
<link href="<?php bloginfo( 'stylesheet_directory' ); ?>/stylesheets/<?php
echo $traction->colorScheme(); ?>.css" type="text/css" media="screen" rel="stylesheet"
/>
<?php } ?>
<link href="<?php bloginfo( 'stylesheet_url' ); ?>" type="text/css" media="screen"
rel="stylesheet" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" media="screen" href="<?php
bloginfo( 'template_url' ); ?>/stylesheets/ie.css" />
<![endif]-->
<!--WordPress-->
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' );
?> RSS Feed" href="<?php bloginfo( 'rss2_url' ); ?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--WP Hooks-->
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_enqueue_script( 'jquery' ); ?>
<?php wp_head(); ?>
<!--Scripts-->
<script type="text/javascript" src="<?php bloginfo( 'template_url' );
?>/javascripts/traction.js"></script>
<?php if ( is_front_page() && ($traction->sliderState() != '' ) ) { ?>
<!--Slider-->
<?php
$autoStart = 0;
$slidespeed = 300;
$fadespeed = 200;
if ($traction->sliderSpeed() != '' ) $slidespeed =
$traction->sliderSpeed();
if ($traction->sliderFade() != '' ) $fadespeed =
$traction->sliderFade();
if ($traction->sliderStart() == 'true' ) $autoStart =
$traction->sliderDelay(); else $autoStart = 0;
?>
<script type="text/javascript" charset="utf-8">
jQuery(function(){
jQuery("#feature").loopedSlider({
containerClick: false,
autoStart: <?php echo $autoStart; ?>,
slidespeed: <?php echo $slidespeed; ?>,
fadespeed: <?php echo $fadespeed; ?>,
autoHeight: 1
});
});
</script>
<?php } ?>
</head>
<body <?php body_class($traction->colorScheme()); ?>>
<div class="skip-content"><a href="#content"><?php _e( 'Skip to content',
'traction' ); ?></a></div>
<div id="pg-nav-bg">
<div class="wrapper clear">
<div id="pg-nav">
<ul class="nav">
<?php if ($traction->hideHome() !== 'true' ) : ?>
<li class="page_item <?php if
(is_front_page()) echo( 'current_page_item' );?>"><a href="<?php bloginfo( 'url' );
?>"><?php _e( 'Home', 'traction' ); ?></a></li>
<?php endif; ?>
<?php if ($traction->hidePages() !== 'true' ) : ?>
<?php wp_list_pages( 'title_li=&exclude='.
$traction->excludedPages()); ?>
<?php endif; ?>
</ul>
</div><!--end pg-nav-->
</div><!--end wrapper-->
</div><!--end page-navigation-bg-->
<div class="wrapper big">
<div id="header" class="clear">
<?php if ($traction->logoState() == 'true' ) : ?>
<div class="logo logo-img">
<a href="<?php bloginfo( 'url' ); ?>"><img
src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/<?php echo
$traction->logoName(); ?>" alt="<?php if ($traction->logoAlt() !== '' ) echo
$traction->logoAlt(); else echo bloginfo( 'name' ); ?>"/></a>
<?php if ($traction->logoTagline() == 'true' ) { ?>
<div id="description">
<?php bloginfo( 'description' ); ?>
</div><!--end description-->
<?php } ?>
</div><!--end logo-->
<?php else : ?>
<div class="logo">
<?php if (is_home()) echo( '<h1 id="title">' );
else echo( '<div id="title">' );?><a href="<?php bloginfo( 'url' ); ?>"><?php
bloginfo( 'name' ); ?></a><?php if (is_home()) echo( '</h1>' ); else echo( '</div>'
);?>
<div id="description">
<?php bloginfo( 'description' ); ?>
</div><!--end description-->
</div><!--end logo-->
<?php endif; ?>
<?php if ($traction->bannerState() != '' ) { ?>
<div class="banner">
<a href="<?php if ($traction->bannerUrl() != '' )
echo $traction->bannerUrl(); else echo "#"; ?>"><img class="alignleft" src="<?php
bloginfo( 'stylesheet_directory' ); ?>/images/ads/<?php if ($traction->bannerImage() !=
'' ) echo $traction->bannerImage(); else echo "468_ad.png"; ?>" width="468"
height="60" alt="<?php if ($traction->bannerAlt() != '' ) echo $traction->bannerAlt();
else echo bloginfo( 'name' ); ?>" /></a>
</div>
<?php } ?>
<div id="cat-nav" class="clear">
<ul class="nav">
<?php if ($traction->hideCategories() != 'true' )
: ?>
<?php wp_list_categories( 'title_li=&
exclude=' . $traction->excludedCategories()); ?>
<?php endif; ?>
</ul>
</div><!--end cat-nav-->
</div><!--end header-->
<?php if (($traction->sliderState() != '' ) && is_front_page() &&
!is_paged() ) { ?>
<?php if (is_file(STYLESHEETPATH . '/featured.php' ))
include(STYLESHEETPATH . '/featured.php' ); else include(TEMPLATEPATH . '/featured.php'
); ?>
<?php } ?>
If you want metatags for every post/page just take out metas for description and keywords of the global condition is_front_page. Your code for head section regarding to metatags could be as follows (look at the comments for each type metatag):
<!-- Title -->
<?php if ( is_front_page() ) : ?>
<title><?php bloginfo( 'name' ); ?></title>
<?php elseif ( is_404() ) : ?>
<title><?php _e( 'Page Not Found |', 'traction' ); ?> | <?php bloginfo( 'name' );
?></title>
<?php elseif ( is_search() ) : ?>
<title><?php printf(__ ("Search results for '%s'", "traction"),
attribute_escape(get_search_query())); ?> | <?php bloginfo( 'name' ); ?></title>
<?php else : ?>
<title><?php wp_title($sep = '' ); ?> | <?php bloginfo( 'name' );?></title>
<?php endif; ?>
<!-- Description / Keywords -->
<meta name="description" content="<?php if ( is_single() ) {
single_post_title('', true);
} else {
bloginfo('name'); echo " - "; bloginfo('description');
}
?>" />
<meta name="keywords" content="mediafire, free movies, download movies, movies
mediafire, online movies, download mediafire movies, movies online, hindi movies,
bollywood movies, english movies, small movies, high quality, small size, free
download, download, download links" />
<meta http-equiv="author" content="M.Naeem Riaz" />
<!-- Basic Meta Data -->
<meta name="Copyright" content="Design is copyright <?php echo date( 'Y' ); ?> The
Theme Foundry" />
<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>;
charset=<?php bloginfo( 'charset' ); ?>" />
<?php if ((is_single() || is_category() || is_page() || is_home()) && (!is_paged())) :
else : ?>
<meta name="robots" content="noindex,follow" />
I want to hide the default Wordpress home page from my website navigation
http://www.dawaf.co.uk/es/portraits
I am using Twenty Eleven as the parent theme but I was wondering whether it was possible to do this using CSS rather than editing the header.php which doesn't seem to work when I remove any reference to 'home'
header.php
<?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" />
<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">
<div class="site-title"><img src="http://www.dawaf.co.uk/es/wp-content/themes/child/images/photosdirector.png"></div>
<?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( '/' ) ); ?>">
<?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 ?>
</a>
<?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"><a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to primary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to primary content', 'twentyeleven' ); ?></a></div>
<div class="skip-link"><a class="assistive-text" href="#secondary" title="<?php esc_attr_e( 'Skip to secondary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to secondary content', 'twentyeleven' ); ?></a></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">
Your header.php is loading the menu dynamically from the Wordpress dashboard. Edit the menu here: Dashboard > Appearance > Menus