PS
the code for the header is this:
<div id="imageMenu">
<?php
$walker = new My_Walker;
wp_nav_menu( array(
'theme_location' => 'custom-sliding-menu',
'fallback_cb' => 'no_sliding_menu',
'container' => '',
'container_class' =>'',
'container_id' =>'',
'menu_class' =>'',
'menu_id' =>'',
'depth' => '1',
'walker' => $walker
)
); ?>
</div>
the code for my walker is this:
class My_Walker extends Walker_Nav_Menu
{
var $item_count = 0;
function end_el(&$output, $item, $depth) {
$output .= "";
}
/**
* @param string $output Passed by reference. Used to append additional content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param int $current_page Menu item ID.
* @param object $args
*/
function start_el(&$output, $item, $depth, $args) {
global $wp_query,$item_count;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
if($item_count <= 5){
if(isset($item->object_id)) {
<strong>$thumbnailid = (int)$item->object_id;
$thumbnail = get_the_post_thumbnail_url( $thumbnailid );</strong>
} else {
$thumbnail = 'http://mac-host.com/slidingdoor/slidingdoor.jpg';
}
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
$class_names = ' class="bk'.(int)$item_count.'" ';
$output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>';
$attributes = ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$item_output = $args->before;
<strong> $item_output = '<a' . $attributes .' style="background: url(\'' . $thumbnail. '\') repeat scroll 0%;">';</strong>
$item_output .= apply_filters( 'the_title', $item->title, $item->ID );
$item_output .= '</a>';
$item_output .= "</li>\n";
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
if($item_count == 6){
if(isset($item->object_id)) {
$thumbnailid = (int)$item->object_id;
$thumbnail = get_the_post_thumbnail_url( $thumbnailid );
} else {
$thumbnail = 'http://mac-host.com/slidingdoor/slidingdoor.jpg';
}
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
$class_names = ' class="bk'.(int)$item_count.'" ';
$output .= $indent . '<li class="bk6" id="menu-item-'. $item->ID . '"' . $value . $class_names .'>';
$attributes = ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$item_output = $args->before;
$item_output = '<a' . $attributes .' style="background: url(\'' . $thumbnail. '\') repeat scroll 0%;">';
$item_output .= apply_filters( 'the_title', $item->title, $item->ID );
$item_output .= '</a>';
$item_output .= "</li>\n";
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
$item_count ++;
}
}
Hello, I am Brazilian.
I’m using your theme and would like to know if this problem has a solution.
I can not link the images to the categories.
Is there a way?
I’m still in the testing phase.
http://blog.cancaonova.com/alemdaneblina