Generating wordpress menu – cant understand the config

If you set option ‘theme_location’ => ‘primary’ you need to be sure that you have registered this menu by the code in functions.php : register_nav_menu( ‘primary’, ‘Primary Menu’ ); And then you need to be sure that you set Primary Menu in Theme Locations here: /wp-admin/nav-menus.php Otherwise, wordpress will call fallback function which is wp_page_menu … Read more

How to put a Menu on the left side of a particular page in WordPress 3.5

register_nav_menus allows you to create a new menu. In your functions.php you can add this code to create a new menu. Then in your template file we can call the menu. You will most likely need to mess with the css to style the menu and make it look pretty. function our_multipe_menu_setup(){ register_nav_menus( array( ‘our_left_side_menu’ … Read more

Menu Limitations

It shouldn;’t be so hard. All you have to do is to use wp_get_nav_menu_items filter. This will add 10 posts to submenu of item which title is equal to ”. function insert_my_posts_to_menu( $items, $menu, $args ) { $menu_order = count($items); $child_items = array(); foreach ( $items as &$item ) { if ( $item->title != ‘<SOME … Read more

Hard coded main navigation

STYLING With a static navigation, the CSS you mentioned, won’t work. Use the simple HTML parameters: #access a:link, #access a:active, #access a:visited{ font-weight: bold; } CODING In my project, I used echo get_the_category_by_ID( 11 ); to echo the Category name of the cat_ID = 11. You can show the cat name by this. For page … Read more

Use menus with anchors

Got it — needed to use a walker function. I used a slightly modified version of the one in this tutorial The main thing I modified was changing $attributes .= ! empty( $item->url ) ? ‘ href=”‘ . esc_attr( $item->url) .'”‘ : ”; to $attributes .= ‘ href=”#’ . esc_attr( basename(get_permalink()) ) .'”‘ ; but … Read more

Update body class based on menu

As @CharlesClarkson has already explained, you cannot modify the page output with PHP after the output has been sent to the browser. Your menu certainly runs after body_class since the menu must run inside the <body> tag. The only PHP solution I see would involve editing your theme templates in addition to the code above … Read more

Display posts from Custom Post Type in category page on front-end

You are better off separating categories for posts and using custom taxonomy types for CPT categories. You’d add this line to your register cpt code ‘taxonomies’ => array( ‘bizdirectory-type’ ), Replacing this line in your code. ‘taxonomies’ => array( ‘category’ ), And then add this code in your functions.php add_action( ‘init’, ‘wpsites_custom_taxonomy_types’ ); function wpsites_custom_taxonomy_types() … Read more