WordPress.org

Forums

Broken permalink structure with wp_nav_menu (12 posts)

  1. Iperdesign_IT
    Member
    Posted 2 years ago #

    Hi guys, im creating a network menù whit the wp_nav_menu function.

    At the moment this is my code:

    $site_list = $wpdb->get_results('SELECT * FROM wp_blogs ORDER BY blog_id');
    	foreach($site_list as $sito){
    		if($sito->blog_id == $current_blog_id || ( ! in_array( $sito->blog_id , $idBlog ) ) ) continue;
    		switch_to_blog($sito->blog_id);
    		$menuNetwork .= wp_nav_menu(array('menu'=>'category-menu','container_id'=>$idnome[$sito->blog_id],'container_class'=>'menu-category-menu-container nascosto','echo'=>0));
    	}

    It generates all menùs i need, but permalink structure is
    http://www.mysite.it/?cat=222
    where should be like this
    http://www.mysite.it/cat-name

    In fact, on the active site, permalink structure works fine, but on the generated menùs, permalinks aren't right.

    This is the site where im working on it: Attualissimo. I hope you can help me :)

  2. Iperdesign_IT
    Member
    Posted 2 years ago #

    Have you read http://wpmututorials.com/plugins/networkwide-menu/ ?

    Thanks, but that is not the solution i'm looking for :(

  3. Then I don't understand what you're doing, since you said you're creating a network wide menu with wp_nav_menu.

    That's exactly what those directions will help you do, but without monkeying with SQL directly.

  4. Iperdesign_IT
    Member
    Posted 2 years ago #

    The point is that i don't have to create additional menus on the main site. I'd like to know why permalinks are broken, since my network menù actually works ( did you see the site? :D )

  5. I did see, and your menu doesn't work (or the permalinks would be functioning, no? ;) )

    1) Where are these menus located? Looking at your code it appears you're trying to pull all the menus from all the sites?

    2) You are aware your css isn't loading?

  6. Iperdesign_IT
    Member
    Posted 2 years ago #

    1) Yes, im pulling all menus into $menuNetwork, then i echo the variable;
    2) Css is loaded ( and js too );

    You can see these menus by hovering the big menù ( News - Gossip - Donna - etc ). They will show to you under that big menù, just try it :)

  7. http://cl.ly/image/2J350p0x3V31

    Whole thing looks like that.

    Anywho. I'd use http://codex.wordpress.org/Function_Reference/switch_to_blog

    For each blog, switch to the blog, pull in the menu, list the items. Though really this is an inefficient way about things. Why are you trying to cross-pollinate all your menus? What;s the thinking there? (I'm asking because maybe there's a better way)

  8. Iperdesign_IT
    Member
    Posted 2 years ago #

    Sorry mate, it seems you looked at the wrong time ( now menus are rights ) ^^"

    BTW, i actually use switch to blog ( just see the code above ).

    I need to take all menus because my customer asked me to do this. Every site has an own menu, and i have to take all these menus and show them all in every single page, once you hover element of the big menù.

    Do you know better ways to do this task? :)

  9. The problem is https - http://attualissimo.it/ works

    Are you actually making a menu for this, or are you trying to list the categories?

    http://codex.wordpress.org/Template_Tags/wp_list_categories would be a better pick, IMO.

  10. Iperdesign_IT
    Member
    Posted 2 years ago #

    Each site has its own menu.
    This menu has categories as links ( for now )

    wp_list_categoris isn't usefull, because on these menus, in the future, there could be posts, pages or other links.

    Thanks for the "https" thing, btw O_O

  11. Bleah. Well. The ?cat_id... should still redirect to the pretty URL.

    How did you add these cats to the menu?

Topic Closed

This topic has been closed to new replies.

About this Topic