Assign a Class to the Current “Tag” for Formatting

Add something like this to the functions file: function current_tag($tags) { global $wp_query; $cid = $wp_query->query_vars[‘cat’]; foreach($tags as $tag) { // match tagid to $cid } } add_filter( ‘get_the_tags’, ‘current_tag’); This won’t work by itself, but it will be a good start for getting the right information to the right place.

How to avoid wp_nav_menu() ID conflict?

The solution is not to call the same ‘theme_location’ more than once. Theme location is intended to represent an explicit location within the template. Just register a separate ‘theme_location’ for each separate location within the template that you want to display a nav menu. Consider your chosen ‘theme_location’ names to be semantic names, representing the … Read more

Making breadcrumb with wp_nav_menu

I couldn’t believe there is not a single FREE plugin available that does this. So I wrote my own function. Here you go. Just copy this to your functions.php: function my_breadcrumb($theme_location = ‘main’, $separator=” > “) { $theme_locations = get_nav_menu_locations(); if( ! isset( $theme_locations[ $theme_location ] ) ) { return ”; } $items = wp_get_nav_menu_items( … Read more

how to create a menu with all sub categories?

This depends on what kind of menu you are talking about: 1) If you are talking about “custom menus” (found in the Backend under Design -> Menus) you can do the following: Create a new function with the action hook add_category inside of this function, you can create a new post of type the menu … Read more

How do I add support to my theme for custom menus?

The easiest way is to use the register_nav_menus function.This should be hooked into ‘after_setup_theme’: function my_cool_menu_function(){ register_nav_menus( array( ‘primary’ => ‘Primary Navigation’ )); } add_action( ‘after_setup_theme’, ‘my_cool_menu_function’ ); Then, in your theme, simply call that menu’s position: wp_nav_menu( array( ‘theme_location’ => ‘primary’ ) );

Check if page is in a certain menu

Here’s the function I wrote to figure this out. You give it a menu slug/name/ID and post/page ID and it returns TRUE if that post/page is in the specified menu and FALSE otherwise. Then it was just simply a matter of a quick if/else statement to check against the two menus and display the correct … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)