Creating separate div classes for elements in an array?
-
I have an array of elements which are basically just 3 buttons. Button 1 takes users to their inbox. Button 2 takes users to page where they can create a new message. Button 3 takes users to the settings page.
The problem is I need to be able to apply a different CSS style to each button, but there is only one overarching class assigned to all 3 buttons which is something like div#button-menu. So I can’t target each individual button, I can only target the div as a whole.
Here is the code that (I think) I need to modify somehow to create separate divs. Not really sure what to do though.
private function get_menu() { $menu = array( 'newmessage' => array( 'title' => __('New Message', 'front-end-pm'), 'action' => 'newmessage', 'priority' => 10 ), 'message_box' => array( 'title' => sprintf(__('Inbox%s', 'front-end-pm'), fep_get_new_message_button() ), 'action' => 'messagebox', 'priority' => 5 ), 'settings' => array( 'title' => __('Settings', 'front-end-pm'), 'action' => 'settings', 'priority' => 15 ), ); if( ! fep_current_user_can( 'send_new_message' ) ) { unset($menu['newmessage']); } $menu = apply_filters('fep_menu_buttons', $menu ); foreach ( $menu as $key => $tab ) { $defaults = array( 'title' => '', 'action' => $key, 'class' => 'fep-button', 'active-class' => 'fep-button-active', 'priority' => 20 ); $menu[$key] = wp_parse_args( $menu[$key], $defaults); } uasort( $menu, 'fep_sort_by_priority' ); return $menu; } }
The topic ‘Creating separate div classes for elements in an array?’ is closed to new replies.