function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $address = rt_wpml_t(RT_THEMESLUG, 'Address', $instance['address']); $phone_1 = rt_wpml_t(RT_THEMESLUG, 'Phone 1', $instance['phone_1']); $phone_2 = rt_wpml_t(RT_THEMESLUG, 'Phone 2', $instance['phone_2']); $fax_1 = rt_wpml_t(RT_THEMESLUG, 'Fax 1', $instance['fax_1']); $fax_2 = rt_wpml_t(RT_THEMESLUG, 'Fax 2', $instance['fax_2']); $mail_1 = rt_wpml_t(RT_THEMESLUG, 'Email 1', $instance['mail_1']); $mail_2 = rt_wpml_t(RT_THEMESLUG, 'Email 2', $instance['mail_2']); $support_mail_1 = rt_wpml_t(RT_THEMESLUG, 'Support Email 1', $instance['support_mail_1']); $support_mail_2 = rt_wpml_t(RT_THEMESLUG, 'Support Email 2', $instance['support_mail_2']); $map_link = rt_wpml_t(RT_THEMESLUG, 'Map Link', $instance['map_link']); $contact_form_link = rt_wpml_t(RT_THEMESLUG, 'Contact Form Link', $instance['contact_form_link']); $map_link_text = rt_wpml_t(RT_THEMESLUG, 'Map Link Text', $instance['map_link_text']); $contact_form_link_text = rt_wpml_t(RT_THEMESLUG, 'Contact Form Link Text', $instance['contact_form_link_text']); //Contact Info $contactInfo = '<ul class="with_icons default default_size">'; if (!empty($address)) { $contactInfo .= '<li><span class="icon-home"></span>' . $address . '</li>'; } if (!empty($phone_1)) { $contactInfo .= '<li><span class="icon-phone"></span>' . $phone_1 . '</li>'; } if (!empty($phone_2)) { $contactInfo .= '<li><span class="icon-phone"></span>' . $phone_2 . '</li>'; } if (!empty($fax_1)) { $contactInfo .= '<li><span class="icon-print"></span>' . $fax_1 . '</li>'; } if (!empty($fax_2)) { $contactInfo .= '<li><span class="icon-print"></span>' . $fax_2 . '</li>'; } if (!empty($mail_1)) { $contactInfo .= '<li><span class="icon-mail-1"></span><a href="mailto:' . $mail_1 . '">' . $mail_1 . '</a></li>'; } if (!empty($mail_2)) { $contactInfo .= '<li><span class="icon-mail-1"></span><a href="mailto:' . $mail_2 . '">' . $mail_2 . '</a></li>'; } if (!empty($support_mail_1)) { $contactInfo .= '<li><span class="icon-lifebuoy"></span><a href="mailto:' . $support_mail_1 . '">' . $support_mail_1 . '</a></li>'; } if (!empty($support_mail_2)) { $contactInfo .= '<li><span class="icon-lifebuoy"></span><a href="mailto:' . $support_mail_2 . '">' . $support_mail_2 . '</a></li>'; } if (!empty($map_link)) { $contactInfo .= '<li><span class="icon-map"></span><a href="' . $map_link . '" title="' . $map_link_text . '">' . $map_link_text . '</a></li>'; } if (!empty($contact_form_link)) { $contactInfo .= '<li><span class="icon-pencil-1"></span><a href="' . $contact_form_link . '" title="' . $contact_form_link_text . '">' . $contact_form_link_text . '</a></li>'; } $contactInfo .= '</ul>'; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } echo $contactInfo; echo $after_widget; }
/** * Social Media Icons Shortcode * * @global class $rttheme * * @param array $atts * @param string $content * @return string $output */ function rt_social_media($atts = array(), $content = null) { global $rttheme, $rt_social_media_icons; $social_media_output = ''; $target = ""; foreach ($rt_social_media_icons as $key => $value) { $link = rt_wpml_t(RT_THEMESLUG, RT_THEMESLUG . '_' . $value, get_theme_mod(RT_THEMESLUG . '_' . $value)); $followText = rt_wpml_t(RT_THEMESLUG, RT_THEMESLUG . '_' . $value . '_text', get_theme_mod(RT_THEMESLUG . '_' . $value . '_text')); $target = get_theme_mod(RT_THEMESLUG . '_' . $value . '_target'); $target = empty($target) ? "_self" : $target; if ($value == "mail") { //e-mail icon link if (strpos($link, "@")) { $link = 'mailto:' . str_replace("mailto:", "", $link); } else { $link = str_replace("mailto:", "", $link); } } else { $link = $link; } //all icons if ($link) { $social_media_output .= '<li class="' . $value . '">'; $social_media_output .= '<a class="icon-' . $value . '" target="' . $target . '" href="' . $link . '" title="' . esc_attr($key) . '">'; !empty($followText) and $social_media_output .= '<span>' . esc_attr($followText) . '</span>'; empty($followText) and $social_media_output .= '<span>' . esc_attr($key) . '</span>'; $social_media_output .= '</a>'; $social_media_output .= '</li>'; } } if ($social_media_output) { return '<ul class="social_media">' . $social_media_output . '</ul>'; } }
function widget($args, $instance) { extract($args); $title = !empty($instance['title']) ? apply_filters('widget_title', $instance['title']) : ""; $address = !empty($instance['address']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Address', $instance['address']) : ""; $phone_1 = !empty($instance['phone_1']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Phone 1', $instance['phone_1']) : ""; $phone_2 = !empty($instance['phone_2']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Phone 2', $instance['phone_2']) : ""; $m_phone_1 = !empty($instance['m_phone_1']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Mobile Phone 1', $instance['m_phone_1']) : ""; $m_phone_2 = !empty($instance['m_phone_2']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Mobile Phone 2', $instance['m_phone_2']) : ""; $fax_1 = !empty($instance['fax_1']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Fax 1', $instance['fax_1']) : ""; $fax_2 = !empty($instance['fax_2']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Fax 2', $instance['fax_2']) : ""; $mail_1 = !empty($instance['mail_1']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Email 1', $instance['mail_1']) : ""; $mail_2 = !empty($instance['mail_2']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Email 2', $instance['mail_2']) : ""; $support_mail_1 = !empty($instance['support_mail_1']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Support Email 1', $instance['support_mail_1']) : ""; $support_mail_2 = !empty($instance['support_mail_2']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Support Email 2', $instance['support_mail_2']) : ""; $map_link = !empty($instance['map_link']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Map Link', $instance['map_link']) : ""; $contact_form_link = !empty($instance['contact_form_link']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Contact Form Link', $instance['contact_form_link']) : ""; $map_link_text = !empty($instance['map_link_text']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Map Link Text', $instance['map_link_text']) : ""; $contact_form_link_text = !empty($instance['contact_form_link_text']) ? rt_wpml_t(RT_THEMESLUG, $this->id . 'Contact Form Link Text', $instance['contact_form_link_text']) : ""; //Contact Info $contactInfo = '<div class="with_icons style-1">'; if (!empty($address)) { $contactInfo .= '<div><span class="icon icon-home"></span><div>' . $address . '</div></div>'; } if (!empty($phone_1)) { $contactInfo .= '<div><span class="icon icon-phone"></span><div>' . $phone_1 . '</div></div>'; } if (!empty($phone_2)) { $contactInfo .= '<div><span class="icon icon-phone"></span><div>' . $phone_2 . '</div></div>'; } if (!empty($m_phone_1)) { $contactInfo .= '<div><span class="icon icon-mobile"></span><div>' . $m_phone_1 . '</div></div>'; } if (!empty($m_phone_2)) { $contactInfo .= '<div><span class="icon icon-mobile"></span><div>' . $m_phone_2 . '</div></div>'; } if (!empty($fax_1)) { $contactInfo .= '<div><span class="icon icon-print"></span><div>' . $fax_1 . '</div></div>'; } if (!empty($fax_2)) { $contactInfo .= '<div><span class="icon icon-print"></span><div>' . $fax_2 . '</div></div>'; } if (!empty($mail_1)) { $contactInfo .= '<div><span class="icon icon-mail-1"></span><div><a href="mailto:' . $mail_1 . '">' . $mail_1 . '</a></div></div>'; } if (!empty($mail_2)) { $contactInfo .= '<div><span class="icon icon-mail-1"></span><div><a href="mailto:' . $mail_2 . '">' . $mail_2 . '</a></div></div>'; } if (!empty($support_mail_1)) { $contactInfo .= '<div><span class="icon icon-lifebuoy"></span><div><a href="mailto:' . $support_mail_1 . '">' . $support_mail_1 . '</a></div></div>'; } if (!empty($support_mail_2)) { $contactInfo .= '<div><span class="icon icon-lifebuoy"></span><div><a href="mailto:' . $support_mail_2 . '">' . $support_mail_2 . '</a></div></div>'; } if (!empty($map_link)) { $contactInfo .= '<div><span class="icon icon-map"></span><div><a href="' . $map_link . '" title="' . $map_link_text . '">' . $map_link_text . '</a></div></div>'; } if (!empty($contact_form_link)) { $contactInfo .= '<div><span class="icon icon-pencil-1"></span><div><a href="' . $contact_form_link . '" title="' . $contact_form_link_text . '">' . $contact_form_link_text . '</a></div></div>'; } $contactInfo .= '</div>'; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } echo $contactInfo; echo $after_widget; }
function rt_top_slogan() { global $rt_header_layout_options; $top_slogan = rt_wpml_t(RT_THEMESLUG, 'Top Slogan', get_option(RT_THEMESLUG . '_top_slogan')); $top_slogan_icon = get_option(RT_THEMESLUG . '_top_slogan_icon'); $top_slogan_icon = !empty($top_slogan_icon) ? '<span class="' . $top_slogan_icon . ' icon"></span>' : ""; $top_slogan_position = get_option(RT_THEMESLUG . '_top_slogan_position'); $add_class = $rt_header_layout_options["logo_position"] == "left" || $rt_header_layout_options["logo_position"] == "center" ? "right_side " : "left_side"; $output = sprintf(' <section id="slogan_text" class="' . $add_class . '"> %s %s </section>', $top_slogan_icon, $top_slogan); echo $output; }
function rt_breadcrumb($args = array()) { global $rt_taxonomy, $post, $rt_delimiter, $rt_opened_divs, $wp_query; //the breadcrumb text before the menu $breadcrumb_text = get_option(RT_THEMESLUG . '_breadcrumb_text') ? get_option(RT_THEMESLUG . '_breadcrumb_text') . " " : ""; //default values $defaults = array('rt_delimiter' => ' <span class="icon-angle-right"></span> ', 'wrap_before' => '', 'wrap_after' => '', 'breadcrumb_text' => '' . rt_wpml_t(RT_THEMESLUG, 'Breadcrumb Menu Text', $breadcrumb_text) . '', 'home' => __('Home', 'rt_theme')); $args = wp_parse_args($args, $defaults); //extract variables extract($args); //define variables $rt_is_bbpress = $breadcrumb = ""; /* WooCommerce Breadcrumb */ if (function_exists('woocommerce_breadcrumb')) { if (is_woocommerce()) { $defaults = array('delimiter' => $rt_delimiter, 'wrap_before' => $wrap_before . '<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a class="icon-home" itemprop="url" href="' . RT_BLOGURL . '"><span title="' . get_bloginfo('name') . '">' . $home . '</span></a></div>' . $rt_delimiter, 'wrap_after' => $wrap_after, 'before' => '', 'after' => '', 'home' => false); woocommerce_breadcrumb($defaults); return false; } } /* YOAST Breadcrumb */ if (function_exists('yoast_breadcrumb')) { $yoast_options = get_option('wpseo_internallinks'); if (isset($yoast_options['breadcrumbs-enable']) && !empty($yoast_options['breadcrumbs-enable'])) { yoast_breadcrumb($wrap_before, $wrap_after); return false; } } $breadcrumb .= $wrap_before; $breadcrumb .= !empty($breadcrumb_text) ? $breadcrumb_text . " " : ""; /* BBPRESS Breadcrumb use BBpress Breadcrumb if for bbpress pages */ if (function_exists('bbp_breadcrumb')) { global $rt_bb_breadcrumb, $rt_wrap_before, $rt_wrap_after, $rt_breadcrumb_text; $rt_wrap_before = $wrap_before; $rt_wrap_after = $wrap_after; $rt_breadcrumb_text = $breadcrumb_text; //check the current page is if it is part of bbpress if (is_bbpress()) { $breadcrumb .= $rt_bb_breadcrumb; $rt_is_bbpress = true; } } //if its not a bbpress page run default breadcrumb if (!$rt_is_bbpress) { //Home Page if (!is_home() && !is_front_page()) { $breadcrumb .= rt_create_breadcrumb_item(array("class" => "icon-home", "sublink" => false, "url" => RT_BLOGURL, "title" => get_bloginfo('name'), "link_name" => $home)); } //Pages if (is_page() && !is_home() && !is_front_page()) { $breadcrumb .= rt_page_parents(); } elseif (is_single() && !is_attachment()) { // Get post type $post_type = get_post_type(); //regular single posts if ($post_type == 'post') { //get base page $breadcrumb .= rt_get_base_page("blog"); $this_category = get_the_category(); if (isset($this_category[0])) { $breadcrumb .= rt_get_category_parents($this_category[0]); } $breadcrumb .= rt_create_breadcrumb_item(array("title" => $post->post_title, "rt_delimiter" => "")); } elseif ($post_type == 'products') { //get base page $breadcrumb .= rt_get_base_page("products"); //categories of post $terms = wp_get_post_terms($post->ID, "product_categories", array('orderby' => 'parent', 'order' => 'DESC')); //select only 1st one and create breadcrumb link if (isset($terms[0])) { $term_link = get_term_link($terms[0]->slug, $terms[0]->taxonomy); $term_name = $terms[0]->name; //check term has parents if ($terms[0]->parent) { $breadcrumb .= rt_get_term_parents($terms[0]->term_id, $terms[0]->taxonomy); } //breadcrumb link of the term $breadcrumb .= rt_create_breadcrumb_item(array("title" => esc_attr(sprintf(__("View all products in %s", "rt_theme"), $term_name)), "link_name" => esc_attr($term_name), "url" => esc_url($term_link))); } //breadcrumb link of current post $breadcrumb .= rt_create_breadcrumb_item(array("title" => $post->post_title, "rt_delimiter" => "")); } elseif ($post_type == 'portfolio') { //get base page $breadcrumb .= rt_get_base_page("portfolio"); //categories of post $terms = wp_get_post_terms($post->ID, "portfolio_categories", array('orderby' => 'parent', 'order' => 'DESC')); //select only 1st one and create breadcrumb link if (isset($terms[0])) { $term_link = get_term_link($terms[0]->slug, $terms[0]->taxonomy); $term_name = $terms[0]->name; //check term has parents if ($terms[0]->parent) { $breadcrumb .= rt_get_term_parents($terms[0]->term_id, $terms[0]->taxonomy); } //breadcrumb link of the term $breadcrumb .= rt_create_breadcrumb_item(array("title" => esc_attr(sprintf(__("View all works in %s", "rt_theme"), $term_name)), "link_name" => esc_attr($term_name), "url" => esc_url($term_link))); } //breadcrumb link of current post $breadcrumb .= rt_create_breadcrumb_item(array("title" => $post->post_title, "rt_delimiter" => "")); } else { //breadcrumb link of current post $breadcrumb .= rt_create_breadcrumb_item(array("title" => $post->post_title, "rt_delimiter" => "")); } } elseif (is_tax()) { //get base page for products if (get_query_var('taxonomy') == "product_categories") { $breadcrumb .= rt_get_base_page("products"); } //get base page for portfolio if (get_query_var('taxonomy') == "portfolio_categories") { $breadcrumb .= rt_get_base_page("portfolio"); } $this_term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); $breadcrumb .= rt_get_term_parents($this_term->term_id, $this_term->taxonomy); $breadcrumb .= rt_create_breadcrumb_item(array("title" => esc_attr($this_term->name), "rt_delimiter" => "")); } elseif (is_category()) { //get base page $breadcrumb .= rt_get_base_page("blog"); $this_category_obj = $wp_query->get_queried_object(); $this_category = get_category($this_category_obj->term_id); if ($this_category->parent) { $breadcrumb .= rt_get_category_parents($this_category->parent); } $breadcrumb .= rt_create_breadcrumb_item(array("title" => esc_attr($this_category->name), "rt_delimiter" => "")); //404 } elseif (is_404()) { $breadcrumb .= rt_create_breadcrumb_item(array("title" => __('Error 404', 'rt_theme'), "rt_delimiter" => "")); //search } elseif (is_search()) { $breadcrumb .= rt_create_breadcrumb_item(array("title" => sprintf(__('Search results for: %s', 'rt_theme'), get_search_query()), "rt_delimiter" => "")); //tag } elseif (is_tag()) { $breadcrumb .= rt_create_breadcrumb_item(array("title" => sprintf(__('Posts tagged: %s', 'rt_theme'), single_tag_title('', false)), "rt_delimiter" => "")); //author } elseif (is_author()) { $breadcrumb .= rt_create_breadcrumb_item(array("title" => sprintf(__('Author: %s', 'rt_theme'), get_the_author()), "rt_delimiter" => "")); //attachment } elseif (is_attachment()) { $this_category = get_the_category(); if ($this_category) { $breadcrumb .= rt_get_category_parents($this_category); } $breadcrumb .= rt_create_breadcrumb_item(array("title" => $post->post_title, "rt_delimiter" => "")); } else { if (!is_home() && !is_front_page()) { $breadcrumb .= rt_create_breadcrumb_item(array("title" => wp_title('', false), "link_name" => wp_title('', false), "rt_delimiter" => "")); } } //close divs for ($i = 0; $i < $rt_opened_divs; $i++) { $breadcrumb .= "</div>"; } } $breadcrumb .= $wrap_after; $breadcrumb_menu = $breadcrumb; //echo breadcrumb echo $breadcrumb_menu; }
/** * Create product price * * @param array $args{ * "regular_price" => $regular_price, * "sale_price" => $sale_price * } * @return output */ function create_rt_product_price($args = array()) { extract($args); $regular_price_output = $sale_price_output = ""; //get currency displaying format from options $currency_location = rt_wpml_t(RT_THEMESLUG, "Currency Location", get_theme_mod(RT_THEMESLUG . "_currency_location")); $currency_location = $currency_location ? $currency_location : "before"; $currency_format = $currency_location == "before" ? "%1\$s%2\$s" : "%2\$s%1\$s"; //currency $currency = apply_filters("rt_product_currency", rt_wpml_t(RT_THEMESLUG, "Currency", get_theme_mod(RT_THEMESLUG . "_currency"))); //regular price with currency $regular_price = !empty($regular_price) ? sprintf($currency_format, $currency, $regular_price) : ""; //sale price with currency $sale_price = !empty($sale_price) ? sprintf($currency_format, $currency, $sale_price) : ""; //regular price output $regular_price_output = !empty($regular_price) ? sprintf('<del><span class="amount">%s</span></del>', $regular_price) : ""; //sale price output $sale_price_output = !empty($sale_price) ? sprintf('<ins><span class="amount">%s</span></ins>', $sale_price) : ""; //price group output $price_output = !empty($regular_price_output) || !empty($sale_price_output) ? sprintf(' <!-- product price --> <p class="price icon-"> %1$s %2$s </p> ', $regular_price_output, $sale_price_output) : ""; echo $price_output; }
} else { ?> <?php //call the footer menu $footermenuVars = array('menu' => 'RT Theme Footer Navigation Menu', 'depth' => 1, 'menu_id' => 'footer_links', 'menu_class' => 'footer_links', 'echo' => false, 'container' => '', 'container_class' => '', 'container_id' => '', 'theme_location' => 'rt-theme-footer-navigation'); $footer_menu = wp_nav_menu($footermenuVars); echo $footer_menu; ?> <!-- / end ul .footer_links --> <?php } ?> <!-- copyright text --> <div class="copyright"><?php echo do_shortcode(rt_wpml_t(RT_THEMESLUG, 'Footer Copyright Text', get_option(RT_THEMESLUG . '_footer_copy'))); ?> </div><!-- / end div .copyright --> </div><!-- / end div .part1 --> <!-- social media icons --> <?php //social media icons if (get_option(RT_THEMESLUG . '_social_media_bottom')) { echo do_shortcode("[rt_social_media_icons]"); } ?> <!-- / end ul .social_media_icons --> </div><!-- / end div .footer_info -->