Add reusable NL/EN contact form with configurable admin settings
This commit is contained in:
commit
3e598b4bae
11 files changed
+633
No files matched your search
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
if(!defined('ABSPATH'))exit;
|
||||
function hgcf_language($content='') {
|
||||
if($content!=='' && preg_match('/'.get_shortcode_regex(['hg_contactform','mlh_contact']).'/s',$content,$match)) {
|
||||
$attrs=shortcode_parse_atts($match[3]);if(is_array($attrs)&&in_array($attrs['lang']??'',['nl','en'],true))return $attrs['lang'];
|
||||
}
|
||||
if(function_exists('pll_current_language')){ $language=pll_current_language('slug');if(in_array($language,['nl','en'],true))return $language; }
|
||||
return str_starts_with(get_locale(),'en')?'en':'nl';
|
||||
}
|
||||
Reference in new issue
Block a user