[FEATURE REQUEST] Menu editor, supports relative URL
Is your feature request related to a problem? Please describe. When I test locally, I should us
Hello,
If this is menu editor, we just need to add slash before the URL, example /about and not just about
@danpros
How to add a variable which equals site_url() in the menu link (slug) field?
For example {site.url}contact
@cuixiping at the moment the menu field does not support variables in the menu yet. Perhaps we can just simply replace the {site.url} to the site_url() during menu generation.
I modified the parseNode function in functions.php to do the replacement. It works for me.
- Add a line:
$nodeSlug = str_replace('{site.url}', site_url(), $node->slug);
- Then replace all
$node->slugwith$nodeSlug
function parseNode($node, $child = null)
{
$nodeSlug = str_replace('{site.url}', site_url(), $node->slug);
...
...
...
}
This shouldn't be hardcoded as I'm fully for relative urls, and adding automatically domain to menu links should be optional.
Maybe as a checkbox + short info about adding "/" before URI or just checking and adding automatically a missing slash