Wordpress logo not clickable back to home page - php

I am currently creating a child theme and the logo is not clickable back to the home page where the code is there.
When I click view source it looks as though as it should be
<div class="tb-logo"> <a href="http://localhost:8080/wordpress-child" class="logo">
<img src="http://localhost:8080/wordpress-child/wp-content/uploads/2015/12/trim-logo.png" alt="name of image"></a></div>. This is the header.php page
<header class="top-bar">
<div class="tb-logo">
<?php
/**
* Check if there is a uploaded logo
*/
$kouki_logo = of_get_option( 'kouki_logo' );
if( $kouki_logo ) : ?>
<a href="<?php echo esc_url(home_url()); ?>" class="logo">
<img src="<?php echo esc_url( $kouki_logo ); ?>" alt="<?php bloginfo( 'name' ); ?>">
</a>
<?php else : ?>
<h1><?php bloginfo( 'name' ); ?></h1>
<?php endif; ?>
</div>
<nav id="menu-child" class="t-lightweight" role="navigation">
<span class="menu-detail"></span>
<ul>
<?php wp_nav_menu( array( 'container' => '', 'items_wrap' => '%3$s' ) ); ?>
</ul>
</nav>
</header>
So I'm not quite sure why it's not making the link clickable. I even tried hard coding it as <img src="image"> but with no luck.
It only works when I don't load the child theme. The original looks like this
<header class="top-bar">
<div class="tb-logo">
<?php
/**
* Check if there is a uploaded logo
*/
$kouki_logo = of_get_option( 'kouki_logo' );
if( $kouki_logo ) : ?>
<a href="<?php echo esc_url(home_url()); ?>" class="logo">
<img src="<?php echo esc_url( $kouki_logo ); ?>" alt="<?php bloginfo( 'name' ); ?>">
</a>
<?php else : ?>
<h1><?php bloginfo( 'name' ); ?></h1>
<?php endif; ?>
</div>
<div class="navigation-toggle-wrapper">
<a class="primary-nav-trigger" href="javascript:void(0)">
<span class="menu-icon"></span>
</a>
<nav id="menu" class="t-lightweight" role="navigation">
<span class="menu-detail"></span>
<ul>
<?php wp_nav_menu( array( 'container' => '', 'items_wrap' => '%3$s' ) ); ?>
</ul>
</nav>
</div>
</header>
So it's something to do with the menu classes but I don't know why?

You didn't pass a parameter in the path to home url. Try this:
<a href="<?php echo esc_url(home_url('/')); ?>" class="logo">
<img src="<?php echo esc_url( $kouki_logo ); ?>" alt="<?php bloginfo( 'name' ); ?>">
</a>
Also, since the home page will forever be the (/) path, unless you wanted the logo to lead to a different page that will be dynamic, you can simple hard code it this way:
<a href="/" class="logo">
<img src="<?php echo esc_url( $kouki_logo ); ?>" alt="<?php bloginfo( 'name' ); ?>">
</a>

Related

Changing header from a logo img to site title

I am trying to change my site header logo from an img to my site name (it would just take my site name from Wordpress settings). I can't figure out how to change this, and I feel like it is just a simple fix. Does anyone have any solutions?
inc/header/style5.php
<?php
$header_color = ot_get_option('header_color', 'light');
?>
<!-- Start Header -->
<header class="header style5 <?php echo esc_attr($header_color); ?>" role="banner">
<div class="row">
<div class="small-2 columns text-left mobile-icon-holder">
<i class="fa fa-bars"></i>
</div>
<div class="small-8 large-12 columns logo">
<div id="menu_width">
<?php if (ot_get_option('thb_logo')) { $logo = ot_get_option('thb_logo'); } else { $logo = THB_THEME_ROOT. '/assets/img/logo.png'; } ?>
<a href="<?php echo esc_url(home_url('/')); ?>" class="logolink">
<img src="<?php echo esc_url($logo); ?>" class="logoimg" alt="<?php bloginfo('name'); ?>"/>
</a>
<nav class="menu-holder">
<?php if (has_nav_menu('nav-menu')) { ?>
<?php wp_nav_menu( array( 'theme_location' => 'nav-menu', 'depth' => 3, 'container' => false, 'menu_class' => 'sf-menu style3', 'walker' => new thb_MegaMenu_tagandcat_Walker ) ); ?>
<?php } else if ( current_user_can( 'edit_theme_options' ) ) { ?>
<ul class="sf-menu style3">
<li><?php esc_html_e( 'Please assign a menu', 'goodlife' ); ?></li>
</ul>
<?php } ?>
</nav>
<?php do_action( 'thb_secondary'); ?>
</div>
</div>
<div class="small-2 columns text-right mobile-share-holder">
<div>
<?php do_action( 'thb_quick_search' ); ?>
</div>
</div>
</div>
</header>
<!-- End Header -->
And I think the only part of this code I have to edit is this little section? I just can't figure out how to edit it correctly.
<?php if (ot_get_option('thb_logo')) { $logo = ot_get_option('thb_logo'); } else { $logo = THB_THEME_ROOT. '/assets/img/logo.png'; } ?>
<a href="<?php echo esc_url(home_url('/')); ?>" class="logolink">
<img src="<?php echo esc_url($logo); ?>" class="logoimg" alt="<?php bloginfo('name'); ?>"/>
</a>
It looks like you just need to change:
<img src="<?php echo esc_url($logo); ?>" class="logoimg" alt="<?php bloginfo('name'); ?>"/>
to simply:
<?php bloginfo('name'); ?>

Adjust header.php

A client has asked me to switch out the site-title with a logo she's designed in the header.php. I've been reading about child themes but don't know enough context to definitively implement the change.
The code is:
<header id="masthead" class="site-header" role="banner">
<hgroup>
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</hgroup>
<nav id="site-navigation" class="main-navigation" role="navigation">
<button class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></button>
<a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
</nav><!-- #site-navigation -->
<?php if ( get_header_image() ) : ?>
<img src="<?php header_image(); ?>" class="header-image" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" />
<?php endif; ?>
</header>`
I just need to replace the site-title with the logo. Any guidance?
I also need to import the image, would I use a FTP? Are there any restrictions on where to save the image?
I do not know much about wordpress. However, this might work,
<header id="masthead" class="site-header" role="banner">
<hgroup>
<h1 class="site-title"><img src="<?php bloginfo('template_directory'); ?>/images/imagename.png" alt="" width="xxx" height="xxx" /></h1>
So, basically what I did is, I replaced <?php bloginfo( 'name' ); ?> from the third line of your code to <img src="<?php bloginfo('template_directory'); ?>/images/imagename.png" alt="" width="xxx" height="xxx" />. Please replace 'template_directory' and "xxx" by proper values.
https://wordpress.org/support/topic/images-within-wordpress-theme-files

how to set the search form next to the site title in wordpress

I want to move the: next to the site title.
For now the search form is under the site title.
I just dont know how to put the "get search" inside the "echo bloginfo".
I want the search form in the right side (after the title.)
This is the php file:
<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<header id="masthead" class="site-header2" role="banner">
<hgroup>
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?> </h2>
</hgroup>
<?php get_search_form(); ?>
<?php if ( get_header_image() ) : ?>
<img src="<?php header_image(); ?>" class="header-image" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" />
<?php endif; ?>
</header><!-- #masthead -->
<div id="main" class="wrapper">
get_search_form() used to display search form you can put like below or you can also adjust with css code.
<hgroup>
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<?php get_search_form(); ?>
<h2 class="site-description"><?php bloginfo( 'description' ); ?> </h2>
</hgroup>

Show only DIV HOMEPAGE

I want to put .masthead-fixed .the main remaining pages ... just not on HOME PAGE
<div id="page" class="hfeed site">
<?php if (!is_home() || !is_front_page()) { ?>
<?php if ( get_header_image() ) : ?>
<div id="site-header">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>">
</a>
</div>
<?php endif; ?>
<header id="masthead" class="site-header" role="banner">
<div class="header-main">
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<div class="search-toggle">
<?php _e( 'Search', 'twentyfourteen' ); ?>
</div>
<nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
<button class="menu-toggle"><?php _e( 'Primary Menu', 'twentyfourteen' ); ?></button>
<a class="screen-reader-text skip-link" href="#content"><?php _e( 'Skip to content', 'twentyfourteen' ); ?></a>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
</nav>
</div>
<div id="search-container" class="search-box-wrapper hide">
<div class="search-box">
<?php get_search_form(); ?>
</div>
</div>
</header><!-- #masthead -->
<?php } ?>
This is the site:
http://avocat.dac-proiect.ro/wp/
This is code CSS:
.masthead-fixed .site-main {
margin-top: 48px;
display:none;
How do you solve this?
I build a Wordpress theme and I want to have content only and not on other pages ... HOME PAGE
.masthead-fixed, .site-main {
You need to put a coma to affect a css rule to many html elements.

Trying to add fontawesome icon to header in wordpress theme

Im trying to add an icon to the left of the main header in my wordpress theme, the code is in php and thats something that I'm not familiar with. I've used filezilla to get the header file from the theme.
Is there anywhere in this code that I can put in the icon or do I need to do this in custom-header.php? The icon I was trying to add is like this <i class="fa fa-cogs"></i>
<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<header id="masthead" class="site-header" role="banner">
<nav id="site-navigation" class="main-navigation" role="navigation">
<h1 class="menu-toggle"><?php _e( 'Menu', 'padhang' ); ?></h1>
<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'padhang' ); ?></a>
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav><!-- #site-navigation -->
<div class="site-branding">
<?php if ( get_header_image() ) : ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<img class="site-logo" src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="<?php bloginfo( 'name' ); ?>">
</a>
<?php endif; ?>
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</div>
</header><!-- #masthead -->
<div id="content" class="site-content">
Simpley you need to enque Font Awesome CSS in your theme's function.php file to load it. And use it in HTML using fa fa-icon Form of syntax.
add_action( 'wp_enqueue_scripts', 'enqueue_load_fa' );
function enqueue_load_fa() {
wp_enqueue_style( 'load-fa', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0 /css/font-awesome.min.css' );
}

Categories