wp_nav_menu() customized

In my basis theme I use a walker for a simplified output: <?php # -*- coding: utf-8 -*- /** * Create a nav menu with very basic markup. * */ class T5_Nav_Menu_Walker_Simple extends Walker_Nav_Menu { /** * Start the element output. * * @param string $output Passed by reference. Used to append additional content. * … Read more

Add column to pages table

Also an tutorial with an solution for page and post to add thumbnail in a column: http://wpengineer.com/1960/display-post-thumbnail-post-page-overview/ Change the content from thumbnail to your content and remove the hooks for post: // for posts // add_filter( ‘manage_posts_columns’, ‘fb_AddThumbColumn’ ); // add_action( ‘manage_posts_custom_column’, ‘fb_AddThumbValue’, 10, 2 ); // for pages add_filter( ‘manage_pages_columns’, ‘fb_AddThumbColumn’ ); add_action( ‘manage_pages_custom_column’, … Read more

How to add current, parent, and ancestor menu item IDs to body_class()?

From my comment earlier: Use the body_class() function in your header.php file or wherever your body tag is, e.g. <body <?php body_class(); ?>>. This will give you an output with a bunch of classes on the body that you can then use in your CSS. For example, <body class=”page page-id-114 page-parent page-template-default logged-in admin-bar”>. You … Read more

Custom metabox for menu administration page?

Just as a follow up for anybody looking to add their own meta boxes to the menu screen, you can do it by using ‘nav-menus’ for the post type: add_action( ‘admin_init’, ‘my_add_meta_box’ ); function my_add_meta_box() { add_meta_box( ‘custom-meta-box’, __(‘My meta box’), ‘my_nav_menu_item_link_meta_box’, ‘nav-menus’, ‘side’, ‘default’ ); } function my_nav_menu_item_link_meta_box() { ?> <div class=”custom-meta-box” id=”custom-meta-box”> Your … Read more

Adding attributes to link in wp_nav_menu using custom Walker function

You want to modify the start_el method as you did the start_lvl one. At its most basic it would mean altering this line: $item_output .= ‘<a’. $attributes .’>’; To look like this one: $item_output .= ‘<a class=”dropdown-toggle” data-toggle=”dropdown”‘. $attributes .’>’; It looks like you will need more complicated logic to avoid inserting that string in … Read more

replace current_page_item class in menu

Add this line at top of your display element function: add_filter(‘nav_menu_css_class’, ‘add_active_class_to_nav_menu’); Add this line at bottom of your display element function: remove_filter(‘nav_menu_css_class’, ‘add_active_class_to_nav_menu’); Add this function somewhere in your themes functions.php: function add_active_class_to_nav_menu($classes) { if (in_array(‘current-menu-item’, $classes, true) || in_array(‘current_page_item’, $classes, true)) { $classes = array_diff($classes, array(‘current-menu-item’, ‘current_page_item’, ‘active’)); $classes[] = ‘active’; } return … Read more

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