168 | | } else if ( current_user_can($item[1]) ) { |
169 | | $menu_file = $item[2]; |
170 | | if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
171 | | $menu_file = substr( $menu_file, 0, $pos ); |
172 | | if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) { |
173 | | $current_theme_actions[] = "<a class='button button-secondary' href='{$item[2]}'$class>{$item[0]}</a>"; |
174 | | } else { |
175 | | $current_theme_actions[] = "<a class='button button-secondary' href='themes.php?page={$item[2]}'$class>{$item[0]}</a>"; |
| 168 | } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { |
| 169 | switch( $item[2] ) { |
| 170 | case 'custom-header' : |
| 171 | $current_theme_actions[] = "<a class='button button-secondary' href='customize.php?autofocus[control]=header_image' $class>{$item[0]}</a>"; |
| 172 | break; |
| 173 | case 'custom-background' : |
| 174 | $current_theme_actions[] = "<a class='button button-secondary' href='customize.php?autofocus[control]=background_image' $class>{$item[0]}</a>"; |
| 175 | break; |
| 176 | default : |
| 177 | $menu_file = $item[2]; |
| 178 | |
| 179 | if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { |
| 180 | $menu_file = substr( $menu_file, 0, $pos ); |
| 181 | } |
| 182 | |
| 183 | if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) { |
| 184 | $current_theme_actions[] = "<a class='button button-secondary' href='{$item[2]}'$class>{$item[0]}</a>"; |
| 185 | } else { |
| 186 | $current_theme_actions[] = "<a class='button button-secondary' href='themes.php?page={$item[2]}'$class>{$item[0]}</a>"; |
| 187 | } |
| 188 | break; |