| 31 | | // contains # and does not start with it |
| 32 | | if (strpos($menu->url,'#')) { |
| 33 | | // check if this is a relative url |
| 34 | | // FIXME this condition needs some additional work because it relys on using the host properly |
| 35 | | // www.domain.com/foo/bar would probably not match https://domain.com/foo/bar |
| 36 | | if (strpos(get_site_url(), $menu->url) === false) { |
| 37 | | $menu_site_url = get_site_url(null, $menu->url); |
| 38 | | $menu_site_id = url_to_postid($menu_site_url); |
| 39 | | // check if the current site is referenced in the menu item |
| 40 | | if ($menu_site_id === get_the_id()) { |
| 41 | | $menu_site_url_explode = explode('#', $menu->url); |
| 42 | | $menu->url = '#' . end($menu_site_url_explode); |
| 43 | | } |
| 44 | | } |
| 45 | | } |
| 46 | | |
| 47 | | return $menu; |
| | 31 | // contains # and does not start with it |
| | 32 | if (strpos($menu->url,'#')) { |
| | 33 | // check if this is a relative url |
| | 34 | // FIXME this condition needs some additional work because it relys on using the host properly |
| | 35 | // www.domain.com/foo/bar would probably not match https://domain.com/foo/bar |
| | 36 | if (strpos(get_site_url(), $menu->url) === false) { |
| | 37 | $menu_site_url = get_site_url(null, $menu->url); |
| | 38 | $menu_site_id = url_to_postid($menu_site_url); |
| | 39 | // check if the current site is referenced in the menu item |
| | 40 | if ($menu_site_id === get_the_id()) { |
| | 41 | $menu_site_url_explode = explode('#', $menu->url); |
| | 42 | $menu->url = '#' . end($menu_site_url_explode); |
| | 43 | } |
| | 44 | } |
| | 45 | } |
| | 46 | return $menu; |