What I'm trying to do is to set a secondary menu on every page that matches the following URL (/example/*)
My problem is that there are some pages generated by the plugin & they aren't accessible in Pages - Wordpress dashboard. So I assigned a secondary menu for those who were there, but the moment I visit those who weren't it's loading primary menu.
I already tried some plugin-based solution and searched for the code-based solutions here, but the closest thing I could find was the code below that seems to be broken or incomplete.
<?php
if (stripos($_SERVER['REQUEST_URI'], '/example/') !== true {
//Set secondary menu here
wp_nav_menu(array('menu' => 'Secondary menu'));
} else {
//Use primary menu`
wp_nav_menu(array('menu' => 'Primary menu'));
}