• [ Moderator note: please wrap code or log lines in backticks or use the code button. I’ve added the backticks to your post. ]

    Hello,

    I’m looking for a solution. I have a website that’s pointed to an anoter domain. The problem is the main nav always links to the not pointed url. So i want to delete the url of the blog in the link;

    <a href="/second-page/">

    in stead of

    </a><a href="http://school.nl/second-page/">

    is that possible?

    The menu code now

    wp_nav_menu(
        	array(
        		'menu' => 'mainNav', /* menu name */
        		'menu_class' => 'nav',
        		'theme_location' => 'mainNav', /* where in the theme it's assigned */
        		'container' => 'false', /* container class */
        		'fallback_cb' => 'bones_main_nav_fallback', /* menu fallback */
        		'depth' => '2', /* suppress lower levels for now */
        		'walker' => new description_walker()
        	)
        );

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    You could add 'echo'=>false, to the argument array and do a search & replace operation on the returned string before echoing it out. Or you can hook the ‘wp_nav_menu’ filter, do the same search and replace on the passed string before returning it.

    Thread Starter heidekeal

    (@heidekeal)

    Thanx for your replay,

    but i’m not a very well programmer so i didn’t get your solution. I do get where i have to put the ‘echo’ =>false, . But how i make a search & replace operation on the retuning string?

    I hope you can help me with that?

    Moderator bcworkz

    (@bcworkz)

    Here is a quick example, it is untested, it may need to be tuned some to work properly. It gives you the basic framework though.

    add_filter('wp_nav_menu', 'hei_no_domain');
    function hei_no_domain($menu) {
       $new_menu = str_replace('http://school.nl/', '/', $menu);
       return $new_menu;
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Nav without blog url’ is closed to new replies.