• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / twentyseventeen_dropdown_icon_to_menu_link() – Add dropdown icon if menu item has children.

You appear to be a bot. Output may be restricted

Description

Add dropdown icon if menu item has children.

Usage

$string = twentyseventeen_dropdown_icon_to_menu_link( $title, $item, $args, $depth );

Parameters

$title
( string ) required – The menu item's title.
$item
( WP_Post ) required – The current menu item.
$args
( stdClass ) required – An object of wp_nav_menu() arguments.
$depth
( int ) required – Depth of menu item. Used for padding.

Returns

string The menu item's title with dropdown icon.

Source

File name: twentyseventeen/inc/icon-functions.php
Lines:

1 to 11 of 11
function twentyseventeen_dropdown_icon_to_menu_link( $title, $item, $args, $depth ) {
  if ( 'top' === $args->theme_location ) {
    foreach ( $item->classes as $value ) {
      if ( 'menu-item-has-children' === $value || 'page_item_has_children' === $value ) {
        $title = $title . twentyseventeen_get_svg( array( 'icon' => 'angle-down' ) );
      }
    }
  }

  return $title;
}
 

 View on GitHub View on Trac

Published: 8th April 2020 | Last updated: 21st August 2020

Primary Sidebar

Information

Function name: twentyseventeen_dropdown_icon_to_menu_link
Plugin ref: Twenty Seventeen
Version: 3.1
Sourcefile: inc/icon-functions.php
File ref: inc/icon-functions.php
Deprecated?: No
API Letters: D,I,M,T

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 6.1.1. PHP: 8.0.28
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites