As you probably remember from when we created the basic skeleton of our theme, the logic for our logo is stored in
public/packages/themes/theme_dreamrs/elements/header.php. Let’s open that file, and focus on the
<header> element where the navigation links and the logo image are located.
First, let’s update the logo link. Instead of linking to
index.html, let’s just make it link to the home page with a “/“:
Unfortunately, this won’t do it. What if the site is installed in a sub-directory? That’s pretty unlikely (and not really the best practice) but it is possible, and we should prepare our theme for that likelihood. If this theme were installed in a subdirectory, linking directly to
/ would traverse all the way to the root of the domain, out of the subdirectory, and lead to a page not found error. Instead, let’s use the
URL class, which is globally available in templates, to link:
Now our link will always work.