Header and menus

Table of contents
Headers and menus are two essential elements of a modern website. With Elementor, it is possible to create header templates and display, using an ad-hoc widget, the menus created with Wordpress.

Introduction

Today, all websites contain one or more headers, as well as a footer. It seems strange to see a web page without a header, at least to display a menu. Elementor has a template builder in its pro version. It is with this tool that the headers are created.

As mentioned in the previous chapter, Elementor’s Hello theme displays the domain name, as well as the slogan at the top of each page. If you have followed me so far in the creation of my website, you will have a home page that contains the title of the site and its slogan, an H1 title formatted with a style sheet and a button.

One of the first things to do when creating a website is to remove all the unnecessary informations and to start with a blank page. By creating a header with Elementor, you kill two birds with one stone.

The home page

Creation of a header

With Elementor, creating a header is very simple. Just go to the menu Templates – Theme Builder and create your header like a classic page. I won’t go into details about header creation, this blog is not an Elementor course.

For the example, I just created a slightly gray section and added my logo on the left.

It is immediately noticeable that the domain name information, as well as the slogan, has disappeared and the header has replaced it.

The home page with an header

Creation of the menu

The Menu is a task that is built in WordPress. Elementor just uses a widget to display it and set it up. You can do many things with the menu widget, including managing menus on smartphones.

To create a menu, go to Appearance – Menus. To display it in your header, drag the Menu widget inside your header section.

Adding locations

Vous pouvez créer plusieurs menus dans une seule page. Cela dépend amplement de votre thème. Avec le thème Hello, il n’est pas possible de gérer You can create several menus in one page. It depends a lot on your theme. With the Hello theme, it is not possible to manage multiple locations, but nothing is impossible.

Add the function below in a PHP file, on your child theme, and you will have two new login and logoff locations. You can then assign your menus to the new locations.

function register_menus() {
    register_nav_menus (
      array (
        'login'                 => ('Login'),
        'logoff'                => ('Logoff')
      )
    );
  }
  add_action ('after_setup_theme', 'register_menus');

Adding icons to the menus

If, like me, you want to add icons to your menus, you can do so directly in the menu creation section. Add to your menu, an HTML tag of type <i>, containing a class whose name is Awesome Font’s own nomenclature. Then, add a second HTML tag of type <span> with the title of your menu.

Example to create the documents menu, insert the html tag <i class=”fas fa-file-pdf” aria-hidden=”true”><span class=”icon-text”>Documents</span></i>, giving this result :

To find the nomenclature, search for your icon on the Awesome Font’s website and copy its name in the menu.

Below, my home menu.

The home menu with icons

Styling a menu with CSS

Even if Elementor offers a whole range of tools to style your menus, it is also possible to do it with a CSS style sheet, which is very practical if you have several menus with identical styles.

The example below shows a menu with a drop shadow and a blue border on its left side.

.sub-menu {
  box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.5);
  border-left: 12px solid #145DA0!important;

You can also play on the menu box, if it is active or under the mouse pointer (hover). The possibilities are endless.

.sub-menu a {
  background-color: #FCFCFC!important;
  color: black;
}

.sub-menu a:hover, .sub-menu a:active {
  background-color: #FCFCFC!important;
  color: red;
}

Here is the header with a menu whose style has been modified with the CSS code above.

A sub-menu modified with CSS

This ends the topic on menus and header. We can tackle an archive page, next topic.

Table of contents
Also to be consulted

Create an App for Azure (part 1)

Why would you create a sitemap

Form and search filter

Create an App for Azure (part 5)

Basic settings for WordPress and Elementor

Create an App for Azure (part 4)

The Prism library

Attachment links

Map of the pages

How to customize the dashboard

Also to be consulted

Create an App for Azure (part 3)

Attachment links

Create an App for Azure (part 1)

Create an App for Azure (part 5)

Leave a comment

Your email address will not be published. Required fields are marked with a *.

Registration

To register, please fill in the fields below

Forgot your password ?

You will receive a message with a link allowing you to renew your password

Password update

Please enter your old password
as well as a new one and confirm it

Login