How to create a menu tab for my toppage

Hi there!

I am doing WordPress, I need to create a menu tab it can link to my top page ( jump to my top page when clicking the tab).

I created a custom link for that, but in that way, I have to hard code my URL of the top page.
So how to define a menu tab for my top page without hard code my URL?

Hi,

If I understand correctly, you could try a relative path to the home page, i.e. the root of the site, like:

URL

/

Navigation Label

Home

Relative paths should work on the dev site too.

It worked! Thanks, man!

1 Like

Thanks for posting what you did. :slight_smile:

I’m afraid what you have is only working on your local dev site. It seems the slash points to the localhost.

The root URL should be just the slash /

The slash is the relative URL of the site root: http://example.com/

If your virtual host is configured in your machines hosts file the slash would point to the root.

Setting up virtual hosts:

CMS systems can sometimes store the hard URL containing the full domain in their database, so it would be convienient to use the real domain name also as the virtual host.

But that would direct the browser to the virtual host, making the live site unreachable from that machine. Checking the live site needs a different machine or temporarly edit the dev machine’s host file.

Another solution could be to change the last letter of the top level tox, e.g: http://example.cox to make the eventual search and replace easy in the database. Though I would rather edit the host file. :slight_smile:

Thanks for posting this lol I was wondering the same thing and seeing the answers on your thread, it has definitely helped someone who is not familiar with the process just yet. Hopefully, it can also help a lot of people like me who are just getting into wordpress and how it will help me in the future.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.