Walker Menu in WordPress
- سُلَيْمَان بْن دَاوُوْد

- Nov 18, 2021
- 1 min read


/*Custom Header Menu*/
class IBenic_Walker extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth=0, $args=array(), $id = 0) {
$object = $item->object;
$type = $item->type;
$title = $item->title;
$description = $item->description;
$permalink = $item->url;
$anchorclass = '';
if($item->ID == 1372){
$anchorclass = 'btn';
}
$output .= "<li class='" . implode(" ", $item->classes) . "'>";
if( $permalink && $permalink != '#' && $depth == 0 ) {
$output .= "<a class='".$anchorclass."' href='" . $permalink . "'><img src='".$description."'/><span>";
$output .= $title;
}else{
$output .= "<a class='".$anchorclass."' href='" . $permalink . "'><span>";
$output .= $title;
}
if( $permalink && $permalink != '#' ) {
$output .= '</span></a>';
}
}
}
Comments