Header
Note : Before This Tutorial you have to knowledge about Designing. This Blog now provide any design related concept.
To Create Header Part create header.php File in your theme folder.
Logo :
In most of all site the header part contain Logo and Menus. So now i discuss how to save a logo in Admin panel and how its shown in Front Site.
To Save Logo in Admin Panel :
To Show this Logo in Website :
<?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="">
</a>
</div>
<?php endif; ?>
The Above Code Shows the Logo and make link to site home page.
After That Now we going to Create Menu :
Firstly Read this Article to Create Menus in Wordpress.
Now Paste Below Function to Show Menus :
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
The above code shows the Menus.
Some time in Header Section There are also a Search Box.
Search Box :
<?php get_search_form(); ?>
The Above Code Shows the Search Form.
This All we are do in Header Part. Now Your Header Part is Complete.
- Login in Admin Panel
- Go to Appearance -> Header.
- Choose Your Logo and Click on "Save Changes" Button.
To Show this Logo in Website :
<?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="">
</a>
</div>
<?php endif; ?>
The Above Code Shows the Logo and make link to site home page.
After That Now we going to Create Menu :
Firstly Read this Article to Create Menus in Wordpress.
Now Paste Below Function to Show Menus :
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
The above code shows the Menus.
Some time in Header Section There are also a Search Box.
Search Box :
<?php get_search_form(); ?>
The Above Code Shows the Search Form.
This All we are do in Header Part. Now Your Header Part is Complete.
Comments
Post a Comment