Minimum Requirements: Canvas V4.0+
In some instances, you may want to remove the custom logo in the header area entirely, move it somewhere else in the design, or add a second copy of the logo somewhere else in the layout. In this tutorial, we’ll discuss moving the Canvas custom logo option into a function that we can add where we like within the layout.
The modifications required for a movable logo are divided into two parts; a customised “header.php” file and a custom action in your “functions.php” file.
The finished code
Before we start, lets take a look at the finished code.
Modified header.php
<?php
/**
* Header Template
*
* Here we setup all logic and XHTML that is required for the header section of all screens.
*
* @package WooFramework
* @subpackage Template
*/
// Setup the tag to be used for the header area (`h1` on the front page and `span` on all others).
$heading_tag = 'span';
if ( is_front_page() ) { $heading_tag = 'h1'; }
// Get our website's name, description and URL. We use them several times below so lets get them once.
$site_title = get_bloginfo( 'name' );
$site_url = home_url( '/' );
$site_description = get_bloginfo( 'description' );
global $woo_options;
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php woo_title(); ?></title>
<?php woo_meta(); ?>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" media="all" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php if ( is_singular() ) { wp_enqueue_script( 'comment-reply' ); } ?>
<?php wp_head(); ?>
<?php woo_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php woo_top(); ?>
<div id="wrapper">
<?php woo_header_before(); ?>
<div id="header" class="col-full">
<?php woo_header_inside(); ?>
<?php if ( ( isset( $woo_options['woo_ad_top'] ) ) && ( $woo_options['woo_ad_top'] == 'true' ) ) { ?>
<div id="topad">
<?php if ( ( isset( $woo_options['woo_ad_top_adsense'] ) ) && ( $woo_options['woo_ad_top_adsense'] != "") ) {
echo stripslashes(get_option('woo_ad_top_adsense'));
} else { ?>
<a href="<?php echo get_option('woo_ad_top_url'); ?>"><img src="<?php echo $woo_options['woo_ad_top_image']; ?>" alt="" /></a>
<?php } ?>
</div><!-- /#topad -->
<?php } ?>
</div><!-- /#header -->
<?php woo_header_after(); ?>
Custom action added to functions.php
add_action( 'woo_header_before', 'woo_custom_add_logo', 12 );
function woo_custom_add_logo() {
global $woo_options;
// Setup the tag to be used for the header area (`h1` on the front page and `span` on all others).
$heading_tag = 'span';
if ( is_front_page() ) { $heading_tag = 'h1'; }
// Get our website's name, description and URL. We use them several times below so lets get them once.
$site_title = get_bloginfo( 'name' );
$site_url = home_url( '/' );
$site_description = get_bloginfo( 'description' );
?>
<div id="logo">
<?php
// Website heading/logo and description text.
if ( isset($woo_options['woo_logo']) && $woo_options['woo_logo'] ) {
echo '<a href="' . $site_url . '" title="' . $site_description . '"><img src="' . $woo_options['woo_logo'] . '" alt="' . $site_title . '" /></a>' . "\n";
} else {
echo '<' . $heading_tag . ' class="site-title"><a href="' . $site_url . '">' . $site_title . '</a></' . $heading_tag . '>' . "\n";
} // End IF Statement
if ( $site_description ) { echo '<span class="site-description">' . $site_description . '</span>' . "\n"; }
?>
</div><!-- /#logo -->
<?php
} // End woo_custom_add_logo()
?>
What the code does
The above code does the following:
- The modified “header.php” file (best added via a child theme) strips out the #logo DIV tag, and it’s contents, from the “header.php” file, to now be added via a custom action.
- The custom action in the “functions.php” file adds the logo code back onto the screen, this time above the #header DIV tag.
To add the logo in it’s original position, as well as use the filter, replace “woo_header_before” with “woo_header_inside”, as below:
add_action( 'woo_header_inside', 'woo_custom_add_logo', 12 );
The final result looks something like this:

The Canvas Logo, Moved Above the Header

The Canvas Logo Code, Moved Above the Header