Changeset 6174
- Timestamp:
- 11/27/2017 06:45:12 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/rosetta/inc/class-plugin.php
r5339 r6174 34 34 private function __construct() { 35 35 add_action( 'plugins_loaded', [ $this, 'plugins_loaded' ], 1 ); 36 add_action( 'wp_nav_menu_objects', [ $this, 'download_button_menu_item' ], 11 ); 36 37 37 38 $this->sites = [ … … 62 63 // Customizations for all sites. 63 64 $this->filter_date_options(); 65 } 66 67 /** 68 * Turns a menu item that links to the Downloads page into a download button. 69 * 70 * @param array $menu_items The menu items, sorted by each menu item's menu order. 71 * @return array 72 */ 73 public function download_button_menu_item( $menu_items ) { 74 foreach ( $menu_items as $menu_item ) { 75 if ( false !== stripos( $menu_item->url, 'download/' ) || 'page-templates/download.php' === get_page_template_slug( $menu_item->object_id ) ) { 76 $menu_item->classes = array_merge( $menu_item->classes, ['button', 'button-primary', 'download'] ); 77 $menu_item->title = _x( 'Download WordPress', 'Menu title', 'rosetta' ); 78 break; 79 } 80 } 81 82 return $menu_items; 64 83 } 65 84
Note: See TracChangeset
for help on using the changeset viewer.