do_action( 'wpml_add_language_form_field' )
- 类型
- action
- 类别
- 全站语言信息
- WPML 版本
- 3.2
说明
输出一个 name=”lang” 且值为当前语言的 HTML 隐藏输入字段。
要向您的主题添加搜索表单,您通常会使用标准的 WordPress 模板标签:get_search_form()
如果您使用的是默认的 WordPress 搜索表单,则无需编辑任何内容。WPML 会处理其余的工作。
但是,有时可能无法使用 get_search_form()。如果您正在创建自定义搜索表单,并且需要使其兼容 WPML,那么您会需要用到这个操作钩子。
参数
此操作钩子没有任何参数。使用示例
将以下代码添加到您的搜索表单代码中。
示例
// Return the HTML code for the current language Spanish // <input type='hidden' name='lang' value='es' /> do_action( 'wpml_add_language_form_field' );
相关钩子
wpml_decode_custom_field, wpml_footer_language_selector, wpml_ls_exclude_in_menu, wpml_is_rtl, wpml_alternate_hreflang, wpml_head_langs, wpml_must_translate_canonical_url, wpml_browser_redirect_language_params, wpml_active_languages, wpml_encode_custom_field