bobbingwide / thisis

ThisIs ... experimental Full Site Editing theme
GNU General Public License v3.0
1 stars 0 forks source link

Implement navigation menu overrides to replace hardcoded links #18

Open bobbingwide opened 3 years ago

bobbingwide commented 3 years ago

The templates and template parts which contain hard coded links prefixed https://s.b/wp55/thisis/ are acceptable when used in a local development environment but not at all acceptable in a live site. The browser attempts to find s.b and takes an awfully long time. Alternatively, in my local development environment, I may not notice the switch.

Given that this is an experimental theme, and I expect to make many changes to template parts with navigation blocks, it would make sense to automatically adjust any URL starting https://s.b/thisis/ to the siteurl(). This may result in a 404, but that’s OK.

Requirement

Proposed solution

bobbingwide commented 3 years ago

The logic in thisis_fiddle_nav_atts() doesn't properly cater for links of the form https://s.b/wp55/thisis/?page_id=nn

The link to the blog, in the header is of this form, with page_id=36. When the URL is parsed the resulting value matches the $url_path, so this is shown as the current menu item when we're viewing the home page.

Conversely, when we visit the blog page Blog is not considered to be the current menu item

Workaround

Change the URL to use a permalink.

bobbingwide commented 3 years ago

The Contact link suffers a similar prolem since the actual URL is about/contact rather than contact.

bobbingwide commented 3 years ago

The Contact page link needs correcting.