首页 WordPress函数大全 get_search_form()

get_search_form()

2020-05-01 / 4705阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

get_search_form( array $args = array() )

Display search form.

描述

Will first attempt to locate the searchform.php file in either the child or the parent, then load it. If it doesn’t exist, then the default search form will be displayed. The default search form is HTML, which will be displayed. There is a filter applied to the search form HTML in order to edit or replace it. The filter is ‘get_search_form’.

This function is primarily used by themes which want to hardcode the search form into the sidebar and also by the search widget in WordPress.

There is also an action that is called whenever the function is run called, ‘pre_get_search_form’. This can be useful for outputting JavaScript that the search relies>

参数

$args

(array)
(Optional)
Array of display arguments.

  • 'echo'
    (bool) Whether to echo or return the form. Default true.
  • 'aria_label'
    (string) ARIA label for the search form. Useful to distinguish multiple search forms>Default value: array()

返回

(void|string) Void if 'echo' argument is true, search form HTML if 'echo' is false.

大家谈论
    我的见解