public function widget($args, $instance) { $this->instance = $instance; $order = hocwp_get_value_by_key($instance, 'order', hocwp_get_value_by_key($this->args, 'order')); $orders = explode(',', $order); $orders = array_map('trim', $orders); $orders = hocwp_sanitize_array($orders); $option_names = $this->args['option_names']; $options = hocwp_get_option('option_social'); $icons = $this->args['icons']; $description = hocwp_get_value_by_key($instance, 'description'); hocwp_widget_before($args, $instance); ob_start(); if (!empty($description)) { echo hocwp_wrap_tag(wpautop($description), 'div', 'description'); } if (hocwp_array_has_value($orders)) { foreach ($orders as $social) { $option_name = hocwp_get_value_by_key($option_names, $social); $item = hocwp_get_value_by_key($options, $option_name); if (!empty($item)) { $icon = '<i class="fa ' . $icons[$social] . '"></i>'; $a = new HOCWP_HTML('a'); $a->set_href($item); $a->set_class('social-item link-' . $social); $a->set_text($icon); $a->output(); } } } $widget_html = ob_get_clean(); $widget_html = apply_filters('hocwp_widget_social_html', $widget_html, $args, $instance, $this); echo $widget_html; hocwp_widget_after($args, $instance); }
function hocwp_product_price($post_id = null, $no_price = '', $args = array()) { $post_id = hocwp_return_post($post_id, 'id'); $regular_price = hocwp_get_post_meta('regular_price', $post_id); $sale_price = hocwp_get_post_meta('sale_price', $post_id); $prices = hocwp_sanitize_product_price($regular_price, $sale_price, $post_id); $price = $prices['price']; $no_price_html = '<span class="no-price">' . __('Price', 'hocwp-theme') . ': <span class="amount">'; $no_price_html .= __('Please call', 'hocwp-theme') . '</span></span>'; $defaults = array('currency' => '$', 'currency_position' => 'left', 'decimals' => 2, 'dec_point' => '.', 'thousands_sep' => ',', 'no_price_html' => $no_price_html); $defaults = apply_filters('hocwp_product_price_defaults', $defaults); $args = wp_parse_args($args, $defaults); $no_price_html = $args['no_price_html']; if (empty($no_price)) { $no_price = $no_price_html; } if (!hocwp_is_positive_number($price)) { $price = $no_price; } else { $sale_price = $prices['sale_price']; $regular_price = $prices['regular_price']; $currency = hocwp_get_value_by_key($args, 'currency'); $currency = apply_filters('hocwp_product_price_currency', $currency); $currency_position = hocwp_get_value_by_key($args, 'currency_position', 'left'); $currency_position = apply_filters('hocwp_product_price_currency_position', $currency_position); $decimals = hocwp_get_value_by_key($args, 'decimals'); $dec_point = hocwp_get_value_by_key($args, 'dec_point'); $thousands_sep = hocwp_get_value_by_key($args, 'thousands_sep'); $number_format = '%NUMBER%'; if ('left' == $currency_position) { $number_format = '%CURRENCY%' . $number_format; } else { $number_format .= '%CURRENCY%'; } $number_format = str_replace('%CURRENCY%', $currency, $number_format); $price = number_format($regular_price, $decimals, $dec_point, $thousands_sep); $price = str_replace('%NUMBER%', $price, $number_format); $price = hocwp_wrap_tag($price, 'span', 'amount'); if (hocwp_is_positive_number($sale_price)) { $sale_price = number_format($sale_price, $decimals, $dec_point, $thousands_sep); $sale_price = str_replace('%NUMBER%', $sale_price, $number_format); $sale_price = hocwp_wrap_tag($sale_price, 'span', 'amount'); $sale_price = hocwp_wrap_tag($sale_price, 'ins'); $price = hocwp_wrap_tag($price, 'del'); $price .= $sale_price; } } if (!empty($price)) { $price = hocwp_wrap_tag($price, 'p', 'price'); echo $price; } }
<div class="<?php hocwp_wrap_class(); ?> "> <?php hocwp_breadcrumb(); hocwp_theme_site_main_before(); if (is_page()) { echo hocwp_wrap_tag(get_the_title(), 'h1', 'page-title entry-title'); } $args = array('post_type' => 'post', 'paged' => hocwp_get_paged()); $query = hocwp_query($args); if ($query->have_posts()) { echo '<div class="loop-posts">'; while ($query->have_posts()) { $query->the_post(); hocwp_theme_get_loop('post'); } wp_reset_postdata(); echo '</div>'; hocwp_pagination(array('query' => $query)); } else { hocwp_theme_get_content_none(); } hocwp_theme_site_main_after(); get_sidebar('secondary'); ?> </div>
function hocwp_setup_theme_widget_title($title, $instance = array(), $id_base = null) { if ('rss' != $id_base) { $title = hocwp_wrap_tag($title, 'span', hocwp_sanitize_html_class($title)); } return $title; }
public function invalid_license_notice() { $plugin_name = hocwp_get_plugin_name($this->file, $this->basename); $plugin_name = hocwp_wrap_tag($plugin_name, 'strong'); $args = array('error' => true, 'title' => __('Error', 'hocwp-theme'), 'text' => sprintf(__('Plugin %1$s is using an invalid license key! If you does not have one, please contact %2$s via email address %3$s for more information.', 'hocwp-theme'), $plugin_name, '<strong>' . HOCWP_NAME . '</strong>', '<a href="mailto:' . esc_attr(HOCWP_EMAIL) . '">' . HOCWP_EMAIL . '</a>')); hocwp_admin_notice($args); }
function hocwp_setup_theme_woocommerce_product_tabs_callback($key, $tab) { $content = hocwp_get_post_meta($key, get_the_ID()); $content = trim($content); $title = hocwp_get_value_by_key($tab, 'title'); if (empty($content)) { $slug = hocwp_sanitize_html_class($key); $hocwp_product_tab = hocwp_get_post_by_slug($slug, 'hocwp_product_tab'); if (!hocwp_is_post($hocwp_product_tab)) { $hocwp_product_tab = hocwp_get_post_by_column('post_title', $title); } if (hocwp_is_post($hocwp_product_tab)) { $content = $hocwp_product_tab->post_content; $content = trim($content); } } if (!empty($content)) { if (!empty($title)) { echo hocwp_wrap_tag($title, 'h2', 'tab-title'); } echo '<div class="hocwp-product-info">'; $embed = new WP_Embed(); $content = $embed->run_shortcode($content); $content = $embed->autoembed($content); hocwp_the_custom_content($content); echo '</div>'; } }
function hocwp_wc_product_fast_buy_button($args = array()) { $post_id = hocwp_get_value_by_key($args, 'post_id'); $post_id = hocwp_return_post($post_id, 'id'); $button_text = hocwp_get_value_by_key($args, 'button_text', __('Buy now', 'hocwp-theme')); $button_text = apply_filters('hocwp_wc_fast_buy_button_text', $button_text); $button_description = hocwp_get_value_by_key($args, 'button_description', __('Fast order, without adding products to cart.', 'hocwp-theme')); $button_description = apply_filters('hocwp_wc_fast_buy_button_description', $button_description); ?> <button data-target="#productBuy<?php echo $post_id; ?> " data-toggle="modal" class="btn-clickable orange fast-buy" type="button"> <?php echo $button_text; if (!empty($button_description)) { $button_description = hocwp_wrap_tag($button_description, 'span'); echo $button_description; } ?> </button> <?php }
function hocwp_the_archive_title($prefix = '') { $title = hocwp_get_archive_title($prefix); if (is_tax() || is_category()) { $title = hocwp_wrap_tag($title, 'h1', 'page-title entry-title'); } else { $title = hocwp_wrap_tag($title, 'h2', 'page-title entry-title'); } echo $title; }
function hocwp_login_form($args = array()) { if (is_user_logged_in()) { return; } $action = hocwp_get_method_value('action', 'get'); if ('register' == $action) { hocwp_register_form($args); return; } if ('lostpassword' == $action) { hocwp_lostpassword_form($args); return; } $defaults = hocwp_account_form_default_args(); $args = wp_parse_args($args, $defaults); $placeholder = (bool) hocwp_get_value_by_key($args, 'placeholder', false); $args['echo'] = false; $form = wp_login_form($args); if ($placeholder) { $form = str_replace('name="log"', 'name="log" placeholder="' . $args['placeholder_username'] . '"', $form); $form = str_replace('name="pwd"', 'name="pwd" placeholder="' . $args['placeholder_password'] . '"', $form); } $logo = hocwp_get_value_by_key($args, 'logo', hocwp_get_login_logo_url()); $hide_form = (bool) hocwp_get_value_by_key($args, 'hide_form'); ?> <div class="hocwp-login-box module"> <div class="module-header text-center"> <?php if (!empty($logo)) { $a = new HOCWP_HTML('a'); $a->set_href(home_url('/')); $a->set_class('logo'); $img = new HOCWP_HTML('img'); $img->set_image_alt(''); $img->set_image_src($logo); $a->set_text($img->build()); $a->output(); } $slogan = new HOCWP_HTML('p'); $slogan->set_class('slogan'); $slogan->set_text(sprintf($args['slogan'], hocwp_get_root_domain_name(home_url('/')))); $slogan->output(); if (isset($_REQUEST['error'])) { echo '<p class="alert alert-danger">' . __('There was an error occurred, please try again.', 'hocwp-theme') . '</p>'; } ?> </div> <div class="module-body"> <h4 class="form-title"><?php _e('Login', 'hocwp-theme'); ?> </h4> <?php if ($hide_form) { $login_form_top = apply_filters('login_form_top', '', $args); $login_form_middle = apply_filters('login_form_middle', '', $args); $login_form_bottom = apply_filters('login_form_bottom', '', $args); $form = $login_form_top . $login_form_middle . $login_form_bottom; $form = hocwp_wrap_tag($form, 'form', 'login-form hocwp-login-form'); echo $form; } else { echo $form; } ?> </div> <div class="module-footer"> <div class="text-center"> <p class="form-nav"> <?php $mails = array('confirm', 'newpass'); if (!isset($_GET['checkemail']) || !in_array($_GET['checkemail'], $mails)) { if (hocwp_users_can_register()) { $registration_url = sprintf('<a href="%s">%s</a>', esc_url(wp_registration_url()), $args['text_register_link']); echo apply_filters('register', $registration_url) . '<span class="sep">|</span>'; } } ?> <a href="<?php echo esc_url(wp_lostpassword_url()); ?> " title="<?php echo $args['title_lostpassword_link']; ?> "><?php echo $args['text_lostpassword_link']; ?> </a> </p> </div> </div> </div> <?php }
function hocwp_term_link_li_html($term) { $link = hocwp_term_link_html($term); $link = hocwp_wrap_tag($link, 'li'); return $link . PHP_EOL; }