This tutorial shows how to create an internal link for a specific page block and assign it to the main menu in WordPress.
There are several ways of creating an internal link. In this tutorial we will use an id attribute of an element as a hook for a link.
In order to create an internal link, you should perform the following:
Log into your Dashboard, go to Pages -> All Pages and open the page that has the block in question in the Text editor mode:
Locate the title of the block you’d like to link. You can use the search tool for that:
Check whether the heading you have located has already an id attribute. If it doesn’t, create it. The result should look like this:
<h2 id="we_provide" style="text-align: center;">We Provide</h2>
After you have found or added an id attribute to the header element of your block, copy the id attribute or write it down.
Go to Appearance -> Menus select from the drop down Header Menu (Header Menus), click Select.
On the left you’ll see three options to insert a menu item: Pages, Custom Links and Categories. Select the Custom Links option and enter the URL for your new link in the form of http://my.website.com/#id, where http://my.website.com/ is your home page URL and #id is the id attribute of the block you’d like to link. Note, if the block is situated on the home page, you don’t need to specify the home page URL just #id. After you have filled out the URL and Link Text fields, click Add to Menu and Save Menu:
Refresh the home page of your site and you will see a new menu item added to the main menu that links to the specific block on the page:
Feel free to check the detailed video tutorial below: