/** * Site footer closing data line */ function footer_micro() { $date = wps_get_theme_option('company_launch_date') ? wps_get_theme_option('company_launch_date') : ''; // If no option found set to Site Name! $name = wps_get_theme_option('company_name') ? wps_get_theme_option('company_name') : get_bloginfo('name'); $disclaimer = wps_get_theme_option('site_disclaimer') ? wps_get_theme_option('site_disclaimer') . ' -' : ''; ?> <div class="page-micro"> <div class="wrapper"> <div class="layout layout--center"> <div class="layout__item"> <small class="page-micro__copy txt--center"><?php echo wp_kses_post($disclaimer); ?> <?php echo esc_html($name); ?> <?php echo esc_html($date); ?> - <?php echo esc_html(date('Y')); ?> </small> </div> </div> </div><!-- wrapper --> </div><!-- page-micro --> <?php }
/** * Website logo function */ function theme_site_logo() { $get_image_id = wps_get_theme_option('company_logo'); $output = ''; $default = '<a href="' . get_home_url() . '">' . get_bloginfo('name') . '</a><br/><small>' . get_bloginfo('description') . '</small>'; /** * Logo HTML wrapper */ $output .= '<div data-ui-component="branding">'; if (wps_get_theme_option('logo_setting') === 'brand_title') { $output .= $default; } else { if ($get_image_id) { $image = wp_get_attachment_image_src($get_image_id, 'full'); $logo = $image[0]; $output .= '<a title="' . get_bloginfo('name') . '" href="' . get_home_url() . '">'; $output .= '<img src="' . $logo . '" alt="' . get_bloginfo('name') . '" class="brand-logo"/>'; $output .= '</a>'; } else { $output .= $default; } } $output .= '</div>'; $allowed_html = array('a' => array('href' => array(), 'title' => array()), 'h1' => array(), 'h2' => array(), 'span' => array(), 'small' => array(), 'br' => array(), 'div' => array(), 'img' => array('src' => array(), 'alt' => array(), 'class' => array())); echo wp_kses($output, $allowed_html); }
/** * Global Content * * @package wps_prime */ function theme_global_content_area() { $area = wps_get_theme_option('global_content_end_area'); if ($area) { if ('' !== $area) { echo '<section class="site-global-content">' . do_shortcode($area) . '</section>'; } } }
/** * Function that creates <link> and <style> font definitions to added to theme head * Calls the settings from theme options panel and maps with the multidimensional array served by base_typo(); * Creates inline style for main font */ function add_theme_fonts() { $fonts = new WpsGetThemeFonts(); $font_main = wps_get_theme_option('main_font_family'); // Get selected font family option. /* If no font is set return */ if (!isset($font_main)) { return; } else { wp_register_style('theme_main_font', $fonts->get_theme_fonts_link()); wp_enqueue_style('theme_main_font'); wp_add_inline_style('theme_main_font', $fonts->get_theme_font_style()); } }
/* Removes empty paragraph tags (<p></p>) and line break tags (<br>) from shortcodes caused by WordPress's wpautop function. */ add_filter('the_content', 'remove_empty_tags_around_shortcodes'); /* Allow shortcode in text widget */ add_filter('widget_text', 'do_shortcode'); /* Allow shortcode in widget title */ add_filter('widget_title', 'do_shortcode'); /* Get option from settings */ if ('disable' === wps_get_theme_option('wps_front_dashicons_use')) { add_action('wp_enqueue_scripts', 'wps_prime_disable_wp_styles'); } /* Get option from settings */ if ('disable' === wps_get_theme_option('wps_front_emoji_use')) { add_action('init', 'disable_wp_emojicons'); } /* Get option from settings */ if ('disable' === wps_get_theme_option('wps_disable_comment_url')) { add_filter('comment_form_default_fields', 'unset_url_field_in_comment'); } /** * 1 Remove all the version numers from the end of css/js enqueued files added to <head> (suggested by pingdom.com) * 2 Remove Comment Form Allowed Tags * 3 Customize Comment Form Place Holder Input Text Fields & Labels http://wpsites.net/web-design/customize-comment-form-place-holder-input-text-fields-labels/ * 4 Customize Comment Form Text Area & Label http://wpsites.net/web-design/customize-comment-field-text-area-label/ * 5 Removes empty paragraph tags (<p></p>) and line break tags (<br>) from shortcodes caused by WordPress's wpautop function. */ /** * 1 Remove wp version param from any enqueued scripts/scripts * * @param string $src Scripts and styles. * @return string */
<?php /** * Widget Options * * @package wps_prime */ /* Get option from settings */ if ('enable' === wps_get_theme_option('wps_admin_widget_options')) { //Add input fields(priority 5, 3 parameters) add_action('in_widget_form', 'wps_in_widget_form', 5, 3); //Callback function for options update (priorität 5, 3 parameters) add_filter('widget_update_callback', 'wps_in_widget_form_update', 5, 3); //add class names (default priority, one parameter) add_filter('dynamic_sidebar_params', 'wps_dynamic_sidebar_params'); } /** * Widget options * Ref: http://wordpress.stackexchange.com/questions/134539/how-to-add-custom-fields-to-settings-in-widget-options-for-all-registered-widget */ function wps_in_widget_form($t, $return, $instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'text' => '', 'widget_class' => '')); if (!isset($instance['widget_class'])) { $instance['widget_class'] = null; } ?> <p> <label for="<?php echo $t->get_field_id('widget_class'); ?>
<?php /** * Template part for displaying posts. * * @link https://codex.wordpress.org/Template_Hierarchy * * @package wps_prime */ $article_display_mode = wps_get_theme_option('archive_article_display_mode'); $ft_img_display = wps_get_theme_option('archive_article_feat_img'); ?> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <header class="entry-header"> <?php the_title(sprintf('<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>'); ?> <?php if ('post' === get_post_type()) { ?> <div class="entry-meta"> <?php wps_prime_posted_on();
/** * 9 Main Email address * ex: [wps_email] */ function wps_main_email_shortcode() { $email = wps_get_theme_option('company_contact_email_address') ? wps_get_theme_option('company_contact_email_address') : 'No email set'; return $email; }
/** * Prints HTML with meta information for the categories, tags and comments. */ function wps_prime_entry_footer() { $meta_setting = wps_get_theme_option('article_meta_visibility'); if ('hide' === $meta_setting) { return; } echo '<div class="entry-meta-content">'; // Hide category and tag text for pages. if ('post' === get_post_type()) { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list(esc_html__(', ', 'wps-prime')); if ($categories_list && wps_prime_categorized_blog()) { printf('<span class="cat-links">' . esc_html__('Posted in %1$s', 'wps-prime') . '</span>', $categories_list); // WPCS: XSS OK. } /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list('', esc_html__(', ', 'wps-prime')); if ($tags_list) { printf('<span class="tags-links">' . esc_html__('Tagged %1$s', 'wps-prime') . '</span>', $tags_list); // WPCS: XSS OK. } } if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) { echo '<span class="comments-link">'; comments_popup_link(esc_html__('Leave a comment', 'wps-prime'), esc_html__('1 Comment', 'wps-prime'), esc_html__('% Comments', 'wps-prime')); echo '</span>'; } edit_post_link(sprintf(esc_html__('Edit %s', 'wps-prime'), the_title('<span class="screen-reader-text">"', '"</span>', false)), '<span class="edit-link">', '</span>'); echo '</div>'; }
public function get_theme_font_style() { $theme_fonts = $this->get_fonts(); // Get registered fonts. $font_main = wps_get_theme_option('main_font_family'); $font_second = wps_get_theme_option('secondary_font_family'); $font_second_status = wps_get_theme_option('second_font_family_status') === 'enabled' ? true : false; $select_b = 'html,body,.font-body'; $select_h = 'h1,h2,h3,h4,h5,h6,.font-heading'; $font_one = '.font-one'; $font_two = '.font-two'; $style = ''; // If no secondary font. if (!$font_second_status) { $style = $select_b . ',' . $select_h . '{font-family:\'' . esc_attr($theme_fonts[$font_main][0]) . '\';' . $theme_fonts[$font_main][3] . ';}'; // If font weight is not the same add heading font weight. $style .= $theme_fonts[$font_main][3] !== $theme_fonts[$font_main][4] ? $select_h . '{' . $theme_fonts[$font_main][4] . ';}' : ''; } // If there is secondary font and it is the same as the body font, concatenate the body and heading selectors. if ($font_second_status && $font_second === $font_main) { $style = $select_b . ',' . $select_h . '{font-family:\'' . esc_attr($theme_fonts[$font_main][0]) . '\';' . $theme_fonts[$font_main][3] . ';}'; // If font weight is not the same add heading font weight. $style .= $theme_fonts[$font_main][3] !== $theme_fonts[$font_main][4] ? $select_h . '{' . $theme_fonts[$font_main][4] . ';}' : ''; } // If there is secondary font and it is NOT the same as the body font. if ($font_second_status && $font_second !== $font_main) { $style = $select_b . '{font-family:\'' . esc_attr($theme_fonts[$font_main][0]) . '\';' . $theme_fonts[$font_main][3] . ';}'; $style .= $select_h . '{font-family:\'' . esc_attr($theme_fonts[$font_second][0]) . '\';' . $theme_fonts[$font_second][4] . ';}'; //Font Family selectors without font weight $style .= $font_one . '{font-family:\'' . esc_attr($theme_fonts[$font_main][0]) . '\';}'; $style .= $font_two . '{font-family:\'' . esc_attr($theme_fonts[$font_second][0]) . '\';}'; } return $style; }