Editing the header.php

I love the theme is working great!

I would just like to replace <?php west_header_text(); ?> with an image how do I do this?

I tried just adding it under with <img… tag but it appears at the top of the page not under the text

Hi,

Those function are placed in functions.php, I suggest you to modify the functions.php file in a child theme. Following is the steps:

  1. create a child theme
  2. open functions.php file in your child theme and add this line:
function west_header_text() {
  if ( !function_exists('pll_register_string') ) {
        $header_text 	= get_theme_mod('header_text', 'TIME TO GO WEST');
	$button_left	= get_theme_mod('button_left', 'Explore');
	$button_right 	= get_theme_mod('button_right', 'Browse');
  } else {
	$header_text 	= pll__(get_theme_mod('header_text', 'TIME TO GO WEST'));
	$button_left	= pll__(get_theme_mod('button_left', 'Explore'));
	$button_right 	= pll__(get_theme_mod('button_right', 'Browse'));	
  }

  $button_left_url	= get_theme_mod('button_left_url', '#primary');
  $button_right_url 	= get_theme_mod('button_right_url', '#primary');
  $custom_header_img = NULL;
  if ( get_theme_mod('site_logo') ){
	$custom_header_img = '<img class="custom-header-image"  src="URL_OF_YOUR_IMAGE" />'; 
  }
  echo '<div class="header-info">
	<div class="header-info-inner">
	<h3 class="header-text">' . wp_kses_post($header_text) . '</h3>
	'.$custom_header_img.'
	<div class="header-buttons">';
	if ($button_left_url) {
		echo '<a class="button header-button left-button" href="' . esc_url($button_left_url) . '">' . esc_html($button_left) . '</a>';
	}
	if ($button_right_url) {
		echo '<a class="button header-button right-button" href="' . esc_url($button_right_url) . '">' . esc_html($button_right) . '</a>';
	}
  echo 		'</div>';
  echo 	'</div>';
  echo '</div>';
}
  1. Don’t refresh your site, because it will produce an error message or your site is blank.

  2. To fix the error, you have to open functions.php file in your parent theme and change this line:

function west_header_text() {
  if ( !function_exists('pll_register_string') ) {
	$header_text 	= get_theme_mod('header_text', 'TIME TO GO WEST');
	$button_left	= get_theme_mod('button_left', 'Explore');
	$button_right 	= get_theme_mod('button_right', 'Browse');
  } else {
	$header_text 	= pll__(get_theme_mod('header_text', 'TIME TO GO WEST'));
	$button_left	= pll__(get_theme_mod('button_left', 'Explore'));
	$button_right 	= pll__(get_theme_mod('button_right', 'Browse'));	
  }
  $button_left_url	= get_theme_mod('button_left_url', '#primary');
  $button_right_url 	= get_theme_mod('button_right_url', '#primary');

  echo '<div class="header-info">
	<div class="header-info-inner">
		<h3 class="header-text">' . wp_kses_post($header_text) . '</h3>
		<div class="header-buttons">';
		if ($button_left_url) {
			echo '<a class="button header-button left-button" href="' . esc_url($button_left_url) . '">' . esc_html($button_left) . '</a>';
		}
		if ($button_right_url) {
			echo '<a class="button header-button right-button" href="' . esc_url($button_right_url) . '">' . esc_html($button_right) . '</a>';
		}
  echo 		'</div>';
  echo 	'</div>';
  echo '</div>';
}

to:

/* function west_header_text() {
  if ( !function_exists('pll_register_string') ) {
	$header_text 	= get_theme_mod('header_text', 'TIME TO GO WEST');
	$button_left	= get_theme_mod('button_left', 'Explore');
	$button_right 	= get_theme_mod('button_right', 'Browse');
  } else {
	$header_text 	= pll__(get_theme_mod('header_text', 'TIME TO GO WEST'));
	$button_left	= pll__(get_theme_mod('button_left', 'Explore'));
	$button_right 	= pll__(get_theme_mod('button_right', 'Browse'));	
  }
  $button_left_url	= get_theme_mod('button_left_url', '#primary');
  $button_right_url 	= get_theme_mod('button_right_url', '#primary');

  echo '<div class="header-info">
	<div class="header-info-inner">
		<h3 class="header-text">' . wp_kses_post($header_text) . '</h3>
		<div class="header-buttons">';
		if ($button_left_url) {
			echo '<a href="' . esc_url($button_left_url) . '">' . esc_html($button_left) . '</a>';
		}
		if ($button_right_url) {
			echo '<a href="' . esc_url($button_right_url) . '">' . esc_html($button_right) . '</a>';
		}
  echo 		'</div>';
  echo 	'</div>';
  echo '</div>';
} */

Let me know how it goes.

Regards,
Awan