function hocwp_google_plus_one_button($args = array()) { $post_id = hocwp_get_value_by_key($args, 'post_id', get_the_ID()); $permalink = hocwp_get_value_by_key($args, 'permalink', get_permalink($post_id)); $size = hocwp_get_value_by_key($args, 'size', 'medium'); $annotation = hocwp_get_value_by_key($args, 'annotation', 'bubble'); $width = hocwp_get_value_by_key($args, 'width', 300); $language = hocwp_get_value_by_key($args, 'language', hocwp_get_language()); if (empty($permalink)) { $permalink = home_url('/'); } ?> <!-- Place this tag where you want the +1 button to render. --> <div class="g-plusone" data-width="<?php echo $width; ?> " data-annotation="<?php echo $annotation; ?> " data-size="<?php echo $size; ?> " data-href="<?php echo esc_url($permalink); ?> "></div> <!-- Place this tag after the last +1 button tag. --> <script type="text/javascript"> window.___gcfg = {lang: '<?php echo $language; ?> '}; (function () { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/platform.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); </script> <?php }
function hocwp_setup_theme_change_contact_form_7_recaptcha_language() { if (wp_script_is('google-recaptcha', 'registered')) { wp_deregister_script('google-recaptcha'); $url = 'https://www.google.com/recaptcha/api.js'; $lang = hocwp_get_language(); if (function_exists('qtranxf_getLanguage')) { $lang = qtranxf_getLanguage(); } $lang = apply_filters('hocwp_wpcf7_recaptcha_language', $lang); $url = add_query_arg(array('hl' => $lang, 'onload' => 'recaptchaCallback', 'render' => 'explicit'), $url); wp_register_script('google-recaptcha', $url, array(), false, true); } }
function hocwp_text_change_text_result($text, $lang, $args) { $lang_option = hocwp_get_language(); if (isset($args, $lang_option)) { $text = $args[$lang_option]; } return $text; }
function hocwp_get_recaptcha_language() { $lang = apply_filters('hocwp_recaptcha_language', hocwp_get_language()); return $lang; }
function hocwp_taxonomy_salary_base() { $lang = hocwp_get_language(); $default = 'salary'; if ('vi' == $lang) { $default = 'muc-luong'; } $option = get_option('hocwp_permalink'); $base = hocwp_get_value_by_key($option, 'salary_base', $default); $base = apply_filters('hocwp_taxonomy_salary_base', $base); if (empty($base)) { $base = $default; } return $base; }
function hocwp_setup_theme_archive_title($title) { if ('vi' == hocwp_get_language()) { $title = hocwp_get_archive_title(); } return $title; }
function hocwp_wc_checkout_fields($fields) { if ('vi' == hocwp_get_language()) { unset($fields['billing']['billing_postcode']); unset($fields['billing']['billing_country']); unset($fields['billing']['billing_company']); unset($fields['billing']['billing_address_2']); unset($fields['billing']['billing_city']); } return $fields; }
function hocwp_register_post_type_news($args = array()) { $lang = hocwp_get_language(); $slug = 'news'; if ('vi' == $lang) { $slug = 'tin-tuc'; } $slug = apply_filters('hocwp_post_type_news_base_slug', $slug); $slug = apply_filters('hocwp_post_type_news_slug', $slug); $defaults = array('name' => __('News', 'hocwp-theme'), 'slug' => $slug, 'post_type' => 'news', 'show_in_admin_bar' => true, 'supports' => array('editor', 'thumbnail', 'comments')); $args = wp_parse_args($args, $defaults); hocwp_register_post_type($args); $slug = 'news-cat'; if ('vi' == $lang) { $slug = 'chuyen-muc'; } $slug = apply_filters('hocwp_taxonomy_news_category_base_slug', $slug); $args = array('name' => __('News Categories', 'hocwp-theme'), 'singular_name' => __('News Category', 'hocwp-theme'), 'post_types' => 'news', 'menu_name' => __('Categories', 'hocwp-theme'), 'slug' => $slug, 'taxonomy' => 'news_cat'); hocwp_register_taxonomy($args); $news_tag = apply_filters('hocwp_post_type_news_tag', false); if ($news_tag) { $slug = 'news-tag'; if ('vi' == $lang) { $slug = 'the'; } $slug = apply_filters('hocwp_taxonomy_news_tag_base_slug', $slug); $args = array('name' => __('News Tags', 'hocwp-theme'), 'singular_name' => __('News Tag', 'hocwp-theme'), 'post_types' => 'news', 'menu_name' => __('Tags', 'hocwp-theme'), 'slug' => $slug, 'hierarchical' => false, 'taxonomy' => 'news_tag'); hocwp_register_taxonomy($args); } }
function hocwp_field_captcha($args = array()) { $lang = hocwp_get_language(); hocwp_sanitize_field_args($args); $captcha = new HOCWP_Captcha(); $id = isset($args['id']) ? $args['id'] : ''; if (hocwp_string_empty($id)) { $id = 'hocwp_captcha'; } $placeholder = isset($args['placeholder']) ? $args['placeholder'] : __('Enter captcha code', 'hocwp-theme'); $class = isset($args['class']) ? $args['class'] : ''; $input_width = isset($args['input_width']) ? absint($args['input_width']) : 125; if (is_numeric($input_width) && '%' !== hocwp_get_last_char($input_width)) { $input_width .= 'px'; } $name = hocwp_get_value_by_key($args, 'name', 'captcha'); if (empty($name)) { $name = 'captcha'; hocwp_transmit_id_and_name($id, $name); } hocwp_add_string_with_space_before($class, 'hocwp-captcha-code'); $args['id'] = $id; hocwp_field_before($args); $image_url = $captcha->generate_image(); ?> <input autocomplete="off" id="<?php echo esc_attr($id); ?> " name="<?php echo esc_attr($name); ?> " placeholder="<?php echo esc_attr($placeholder); ?> " class="<?php echo esc_attr($class); ?> " type="text" style="width: <?php echo $input_width; ?> ;" required> <img class="hocwp-captcha-image" src="<?php echo $image_url; ?> "> <img class="hocwp-captcha-reload" src="<?php echo HOCWP_URL . '/images/icon-refresh-captcha.png'; ?> "> <?php hocwp_field_after($args); }
function hocwp_account_form_default_args() { $lang = hocwp_get_language(); $defaults = array('placeholder_username' => __('Username or email', 'hocwp-theme'), 'placeholder_password' => __('Password', 'hocwp-theme'), 'slogan' => __('One free account gets you into everything %s.', 'hocwp-theme'), 'title_lostpassword_link' => __('Password Lost and Found', 'hocwp-theme'), 'text_lostpassword_link' => __('Lost your password?', 'hocwp-theme'), 'text_register_link' => __('Register', 'hocwp-theme'), 'label_email' => __('Email', 'hocwp-theme'), 'label_confirm_password' => __('Confirm your password', 'hocwp-theme'), 'label_phone' => __('Phone', 'hocwp-theme')); return apply_filters('hocwp_account_form_default_args', $defaults); }