• Resolved elena_mae

    (@elena_mae)


    I’m using The Morning After theme for my website https://www.lets-tread-water.com/. In the Theme Options there is no option to add a custom logo to replace the blog title and description in the header. I need help editing the Header.php code in order to do that.

    Here is the Header.php code in its entirety:

    <?php
    /**
     * The Header for our theme.
     *
     * @package WordPress
     * @subpackage The Morning After
     */
    ?>
    <!DOCTYPE html>
    <!--[if IE 7]>
    <html id="ie7" <?php language_attributes(); ?>>
    <![endif]-->
    <!--[if (gt IE 7) | (!IE)]><!-->
    <html <?php language_attributes(); ?>>
    <!--<![endif]-->
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    <link rel="profile" href="https://gmpg.org/xfn/11" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <?php $morningafter_options = morningafter_get_theme_options();  ?>
    <?php wp_head(); ?>
    </head>
    
    <body <?php body_class(); ?>>
    
    	<div class="container">
    	<?php do_action( 'before' ); ?>
    
    		<div id="header" class="column full-width clear-fix">
    
    			<div id="logo" class="column first">
    				<div class="title">
    					<?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'h3'; ?>
    					<<?php echo $heading_tag; ?> class="site-title">
    						<a href="<?php echo home_url( '/' ); ?>"><?php bloginfo( 'name' ); ?></a>
    					</<?php echo $heading_tag; ?>>
    					<div class="site-description desc"><?php bloginfo( 'description' ); ?></div>
    				</div>
    			</div><!-- end logo -->
    
    			<div id="search_menu" class="column border_left last">
    				<div id="search" class="column first">
    					<h3 class="mast4"><?php _e( 'Search','woothemes' ); ?></h3>
    
    					<div id="search-form">
    						<form method="get" id="searchform" action="<?php echo home_url( '/' ); ?>/">
    							<div class="clear-fix">
    								<label for="s" class="none"><?php _e( 'Search for','woothemes' ); ?>:</label>
    								<input type="text" name="s" id="s" class="search_input" value="<?php the_search_query(); ?>" />
    								<label for="searchsubmit" class="none"><?php _e( 'Go','woothemes' ); ?></label>
    								<input type="submit" id="searchsubmit" class="submit_input" value="Search" />
    							</div>
    						</form>
    					</div>
    				</div><!-- end #search -->
    				<ul id="menu" class="clear-fix">
    					<?php
    						$links = array(
    							array(
    								'slug' => 'home',
    								'label' => __( 'Home', 'woothemes' ),
    							),
    							array(
    								'slug' => 'about',
    								'label' => __( 'About', 'woothemes' ),
    							),
    							array(
    								'slug' => 'archives',
    								'label' => __( 'Archives', 'woothemes' ),
    							),
    							array(
    								'slug' => 'subscribe',
    								'label' => __( 'Subscribe', 'woothemes' ),
    							),
    							array(
    								'slug' => 'contact',
    								'label' => __( 'Contact', 'woothemes' ),
    							),
    						);
    
    						foreach ( $links as $order => $link ) {
    							$url = '';
    							if ( isset( $morningafter_options[$link['slug']] ) )
    								$url = trim( $morningafter_options[$link['slug']] );
    
    							if ( ! in_array( $url, array( '', '#' ) ) )
    								echo '<li><span class="' . esc_attr( $link['slug'] ) . '"><a href="' . esc_url( $url ) . '">' . $link['label'] . '</a></span></li>' . "\n";
    						}
    					?>
    				</ul>
    			</div><!-- end #search_menu -->
    
    		</div><!-- end #header -->
    
    		<div id="navigation" class="clear-fix">
    			<?php wp_nav_menu( array( 'depth' => 6, 'menu_class' => 'nav fl', 'theme_location' => 'primary' ) ); ?>
    			<?php if ( $morningafter_options['show_feed_link'] == "1" ) { ?>
    				<ul class="rss fr">
    					<li class="sub-rss"><a href="<?php bloginfo( 'rss_url' ); ?>"><?php _e( 'Subscribe to RSS', 'woothemes' ); ?></a></li>
    				</ul>
    			<?php } ?>
    		</div><!-- #navigation -->

    What would I have to add/change in this code, and where in the code would it go?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi elena_mae

    Are you on wordpres.org or wordpress.com, if it is second option, then we can have a problem to do much. I took a look to the header.php and from the first look I do not see any option to add logo pix.
    BUT
    First make a duplicate of your header.php file!!!!!!!
    then
    I copied your header.php to my editor and found some errors. I did some correction and before we do any further action, try to replace new code to your header.php and try to see if anything happened,

    <?php
    /**
     * The Header for our theme.
     *
     * @package WordPress
     * @subpackage The Morning After
     */
    ?>
    <!DOCTYPE html>
    <!--[if IE 7]>
    <html id="ie7" <?php language_attributes(); ?>>
    <![endif]-->
    <!--[if (gt IE 7) | (!IE)]><!-->
    <html <?php language_attributes(); ?>>
    <!--<![endif]-->
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    <link rel="profile" href="https://gmpg.org/xfn/11" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <?php $morningafter_options = morningafter_get_theme_options();  ?>
    <?php wp_head(); ?>
    </head>
    
    <body <?php body_class(); ?>>
    
    	<div class="container">
    	<?php do_action( 'before' ); ?>
    
    		<div id="header" class="column full-width clear-fix">
    
    			<div id="logo" class="column first">
    				<div class="title">
    					<?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'h3'; ?>
    					<?php echo $heading_tag; ?> class="site-title">
    						<a href="<?php echo home_url( '/' ); ?>"><?php bloginfo( 'name' ); ?></a>
    					<?php echo $heading_tag; ?>
    					<div class="site-description desc"><?php bloginfo( 'description' ); ?></div>
    				</div>
    			</div><!-- end logo -->
    
    			<div id="search_menu" class="column border_left last">
    				<div id="search" class="column first">
    					<h3 class="mast4"><?php _e( 'Search','woothemes' ); ?></h3>
    
    					<div id="search-form">
    						<form method="get" id="searchform" action="<?php echo home_url( '/' ); ?>/">
    							<div class="clear-fix">
    								<label for="s" class="none"><?php _e( 'Search for','woothemes' ); ?>:</label>
    								<input type="text" name="s" id="s" class="search_input" value="<?php the_search_query(); ?>" />
    								<label for="searchsubmit" class="none"><?php _e( 'Go','woothemes' ); ?></label>
    								<input type="submit" id="searchsubmit" class="submit_input" value="Search" />
    							</div>
    						</form>
    					</div>
    				</div><!-- end #search -->
    				<ul id="menu" class="clear-fix">
    					<?php
    						$links = array(
    							array(
    								'slug' => 'home',
    								'label' => __( 'Home', 'woothemes' ),
    							),
    							array(
    								'slug' => 'about',
    								'label' => __( 'About', 'woothemes' ),
    							),
    							array(
    								'slug' => 'archives',
    								'label' => __( 'Archives', 'woothemes' ),
    							),
    							array(
    								'slug' => 'subscribe',
    								'label' => __( 'Subscribe', 'woothemes' ),
    							),
    							array(
    								'slug' => 'contact',
    								'label' => __( 'Contact', 'woothemes' ),
    							),
    						);
    
    						foreach ( $links as $order => $link ) {
    							$url = '';
    							if ( isset( $morningafter_options[$link['slug']] ) )
    								$url = trim( $morningafter_options[$link['slug']] );
    
    							if ( ! in_array( $url, array( '', '#' ) ) )
    								echo '<li><span class="' . esc_attr( $link['slug'] ) . '"><a href="' . esc_url( $url ) . '">' . $link['label'] . '</a></span></li>' . "\n";
    						}
    					?>
    				</ul>
    			</div><!-- end #search_menu -->
    
    		</div><!-- end #header -->
    
    		<div id="navigation" class="clear-fix">
    			<?php wp_nav_menu( array( 'depth' => 6, 'menu_class' => 'nav fl', 'theme_location' => 'primary' ) ); ?>
    			<?php if ( $morningafter_options['show_feed_link'] == "1" ) { ?>
    				<ul class="rss fr">
    					<li class="sub-rss"><a href="<?php bloginfo( 'rss_url' ); ?>"><?php _e( 'Subscribe to RSS', 'woothemes' ); ?></a></li>
    				</ul>
    			<?php } ?>
    		</div><!-- #navigation -->

    Let me know if there were anz changes
    Cheers
    TR

    If it does not help then:

    I created new php to your header.php

    <!--header logo start-->
    				<?php if ( get_header_image() != '' ) : ?>
    						<div id="logo">
    							<div class="container">
    								<div class="row">
    									<a href="<?php echo home_url( '/' ); ?>"><img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="<?php bloginfo( 'name' ); ?>"/></a>
    								</div>
    							</div>
    						</div><!-- end of #logo -->
    				<?php endif; // header image was removed ?>
    <!--header logo end-->
    repace
    <?php header_image(); ?>
    
    in
    
    src="<?php header_image(); ?>" in code I added
    
    with something like this 
    
    https://yoursite/media/yourpix.png
    
    src="https://yoursite/media/yourpix.png"

    HERE IS TWEAKED HEADER.PHP

    <?php
    /**
     * The Header for our theme.
     *
     * @package WordPress
     * @subpackage The Morning After
     */
    ?>
    <!DOCTYPE html>
    <!--[if IE 7]>
    <html id="ie7" <?php language_attributes(); ?>>
    <![endif]-->
    <!--[if (gt IE 7) | (!IE)]><!-->
    <html <?php language_attributes(); ?>>
    <!--<![endif]-->
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    <link rel="profile" href="https://gmpg.org/xfn/11" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <?php $morningafter_options = morningafter_get_theme_options();  ?>
    <?php wp_head(); ?>
    </head>
    
    <body <?php body_class(); ?>>
    
    	<div class="container">
    	<?php do_action( 'before' ); ?>
    
    		<div id="header" class="column full-width clear-fix">
    
    			<div id="logo" class="column first">
    
    <!--header logo start-->
    				<?php if ( get_header_image() != '' ) : ?>
    						<div id="logo">
    							<div class="container">
    								<div class="row">
    									<a href="<?php echo home_url( '/' ); ?>"><img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="<?php bloginfo( 'name' ); ?>"/></a>
    								</div>
    							</div>
    						</div><!-- end of #logo -->
    				<?php endif; // header image was removed ?>
    <!--header logo end-->
    
    				<div class="title">
    					<?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'h3'; ?>
    					<?php echo $heading_tag; ?> class="site-title">
    						<a href="<?php echo home_url( '/' ); ?>"><?php bloginfo( 'name' ); ?></a>
    					<?php echo $heading_tag; ?>
    					<div class="site-description desc"><?php bloginfo( 'description' ); ?></div>
    				</div>
    			</div><!-- end logo -->
    
    			<div id="search_menu" class="column border_left last">
    				<div id="search" class="column first">
    					<h3 class="mast4"><?php _e( 'Search','woothemes' ); ?></h3>
    
    					<div id="search-form">
    						<form method="get" id="searchform" action="<?php echo home_url( '/' ); ?>/">
    							<div class="clear-fix">
    								<label for="s" class="none"><?php _e( 'Search for','woothemes' ); ?>:</label>
    								<input type="text" name="s" id="s" class="search_input" value="<?php the_search_query(); ?>" />
    								<label for="searchsubmit" class="none"><?php _e( 'Go','woothemes' ); ?></label>
    								<input type="submit" id="searchsubmit" class="submit_input" value="Search" />
    							</div>
    						</form>
    					</div>
    				</div><!-- end #search -->
    				<ul id="menu" class="clear-fix">
    					<?php
    						$links = array(
    							array(
    								'slug' => 'home',
    								'label' => __( 'Home', 'woothemes' ),
    							),
    							array(
    								'slug' => 'about',
    								'label' => __( 'About', 'woothemes' ),
    							),
    							array(
    								'slug' => 'archives',
    								'label' => __( 'Archives', 'woothemes' ),
    							),
    							array(
    								'slug' => 'subscribe',
    								'label' => __( 'Subscribe', 'woothemes' ),
    							),
    							array(
    								'slug' => 'contact',
    								'label' => __( 'Contact', 'woothemes' ),
    							),
    						);
    
    						foreach ( $links as $order => $link ) {
    							$url = '';
    							if ( isset( $morningafter_options[$link['slug']] ) )
    								$url = trim( $morningafter_options[$link['slug']] );
    
    							if ( ! in_array( $url, array( '', '#' ) ) )
    								echo '<li><span class="' . esc_attr( $link['slug'] ) . '"><a href="' . esc_url( $url ) . '">' . $link['label'] . '</a></span></li>' . "\n";
    						}
    					?>
    				</ul>
    			</div><!-- end #search_menu -->
    
    		</div><!-- end #header -->
    
    		<div id="navigation" class="clear-fix">
    			<?php wp_nav_menu( array( 'depth' => 6, 'menu_class' => 'nav fl', 'theme_location' => 'primary' ) ); ?>
    			<?php if ( $morningafter_options['show_feed_link'] == "1" ) { ?>
    				<ul class="rss fr">
    					<li class="sub-rss"><a href="<?php bloginfo( 'rss_url' ); ?>"><?php _e( 'Subscribe to RSS', 'woothemes' ); ?></a></li>
    				</ul>
    			<?php } ?>
    		</div><!-- #navigation -->

    LET ME KNOW THE RESULT.
    I TOOK A CODE FROM OTHER THEME TO TRY IT.
    CHEERRS
    TR

    Thread Starter elena_mae

    (@elena_mae)

    Thanks for all of your help – I ended up switching to the Woo Themes version of TMA, which does have an option to upload your own logo. If I switch back to the other one, I’ll let you know if this works!

    Hi Elena,
    Great news that you have some progress.
    Let me know the results, feel free to ask in the future, will be happy to help.
    have a great day
    Cheers
    TR

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding custom logo instead of blog title and description’ is closed to new replies.