/** * Replace the default search form with a Actions-specific form. * * The exact output depends on whether the child theme supports HTML5 or not. * * Applies the `actions_search_text`, `actions_search_button_text`, `actions_search_form_label` and * `actions_search_form` filters. * * @since 0.2.0 * * @uses actions_html5() Check for HTML5 support. * * @return string HTML markup. */ function actions_search_form() { $search_text = get_search_query() ? apply_filters('the_search_query', get_search_query()) : apply_filters('actions_search_text', __('Search this website', 'actions') . ' …'); $button_text = apply_filters('actions_search_button_text', esc_attr__('Search', 'actions')); $onfocus = "if ( '" . esc_js($search_text) . "' === this.value ) {this.value = '';}"; $onblur = "if ( '' === this.value ) {this.value = '" . esc_js($search_text) . "';}"; //* Empty label, by default. Filterable. $label = apply_filters('actions_search_form_label', ''); $value_or_placeholder = get_search_query() == '' ? 'placeholder' : 'value'; if (actions_html5()) { $form = sprintf('<form %s>', actions_attr('search-form')); $form = sprintf('<form method="get" class="searchform search-form" action="%s" role="search" >%s<input type="text" value="%s" name="s" class="s search-input" onfocus="%s" onblur="%s" /><input type="submit" class="searchsubmit search-submit" value="%s" /></form>', esc_url(home_url('/')), esc_html($label), esc_attr($search_text), esc_attr($onfocus), esc_attr($onblur), esc_attr($button_text)); } return apply_filters('actions_search_form', $form, $search_text, $button_text, $label); }
/** * Determine if theme support actions-accessibility is activated by the child theme. * Assumes the presence of a screen-reader-text class in the stylesheet (required generated class as from WordPress 4.2) * * Adds screen-reader-text by default. * Skip links to primary navigation, main contant, sidebars and footer, semantic headings and a keyboard accessible drop-down-menu * can be added as extra features as: 'skip-links', 'headings', 'drop-down-menu' * * @since 2.2.0 * * @param string $arg Optional. Specific accessibility feature to check for support. Default is screen-reader-text. * * @return bool True if current theme supports actions-accessibility, or an specific feature of it, false otherwise. */ function actions_a11y($arg = 'screen-reader-text') { //* No a11y if not html5 if (!actions_html5()) { return false; } $feature = 'actions-accessibility'; if ('screen-reader-text' === $arg) { return current_theme_supports($feature); } $support = get_theme_support($feature); // No support for feature. if (!$support) { return false; } // No args passed in to add_theme_support(), so accept none. if (!isset($support[0])) { return false; } // Support for specific arg found. if (in_array($arg, $support[0])) { return true; } }