Support » Plugin: Menu » [Plugin: Menu] How to set the class attribute in anchors to use a jQuery script

Viewing 1 replies (of 1 total)
  • Hello,
    Can anyone help me?

    I have looked into plugin’s files and I have found these pieces of code that perhaps can be used to do something:

    in menu.php on line 106 I have found

    private function renderMenuItem($item,$count = 99) {
    			$class = $this->getItemClass($item,$count);
    			$output = '<li class="' . $class . '"><a class="' . $class . '" href="' . $this->getItemUrl($item) . '">' . esc_html($item['label']) . '</a></li>';
    			return $output;

    while in views/settings.php on line 36

    	<label><span><?php _e( 'Label' ); ?></span> <input type="text" class="regular-text" name="menu[label][]" value="<?php echo esc_attr($item['label']); ?>" /></label>
    	<label><span><?php _e( 'URL' ); ?></span> <input type="text" class="regular-text" name="menu[url][]" value="<?php echo esc_attr($item['url']); ?>" /></label>
    	<label><span><?php _e( 'CSS Class' ); ?></span> <input type="text" class="regular-text" name="menu[class][]" value="<?php echo esc_attr($item['class']); ?>" /></label>

    What I have thought is that if we could create a new variable to replace $class in

    <a class="' . $class . '" href="' . $this->getItemUrl($item) . '">

    then we could add a new input field in settings.php, something like this

    <label><span><?php _e( 'A Class' ); ?></span> <input type="text" class="regular-text" name="menu[aclass][]" value="<?php echo esc_attr($item['aclass']); ?>" /></label>

    Sorry for my Bad English…
    If anyone has understood, can help me understand?


Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Menu] How to set the class attribute in anchors to use a jQuery script’ is closed to new replies.