/** * Returns the correct title to display for any post/page/archive * * @package Total WordPress Theme * @subpackage Framework */ function wpex_title() { // Default title is null $title = NULL; // Get post ID from global object $post_id = wpex_global_obj('post_id'); // Homepage - display blog description if not a static page if (is_front_page() && !is_singular('page')) { if (get_bloginfo('description')) { $title = get_bloginfo('description'); } else { return __('Recent Posts', 'wpex'); } // Homepage posts page } elseif (is_home() && !is_singular('page')) { $title = get_the_title(get_option('page_for_posts', true)); } elseif (is_search()) { global $wp_query; $title = '<span id="search-results-count">' . $wp_query->found_posts . '</span> ' . __('Search Results Found', 'wpex'); } elseif (is_archive()) { // Author if (is_author()) { /*$title = sprintf( __( 'All posts by%s', 'wpex' ),': <span class="vcard">' . get_the_author() . '</span>' );*/ $title = get_the_archive_title(); } elseif (is_post_type_archive()) { $title = post_type_archive_title('', false); } elseif (is_day()) { $title = sprintf(__('Daily Archives: %s', 'wpex'), get_the_date()); } elseif (is_month()) { $title = sprintf(__('Monthly Archives: %s', 'wpex'), get_the_date(_x('F Y', 'monthly archives date format', 'wpex'))); } elseif (is_year()) { $title = sprintf(__('Yearly Archives: %s', 'wpex'), get_the_date(_x('Y', 'yearly archives date format', 'wpex'))); } else { // Get term title $title = single_term_title('', false); // Fix for bbPress and other plugins that are archives but use pages if (!$title) { global $post; $title = get_the_title($post_id); } } } elseif (is_404()) { $title = wpex_get_mod('error_page_title'); $title = $title ? $title : __('404: Page Not Found', 'wpex'); $title = wpex_translate_theme_mod('error_page_title', $title); } elseif ($post_id) { // Single posts custom text if (is_singular('post') && 'custom_text' == wpex_get_mod('blog_single_header', 'custom_text')) { $title = wpex_get_mod('blog_single_header_custom_text', __('Blog', 'wpex')); } else { $title = get_the_title($post_id); } } // Backup $title = $title ? $title : get_the_title(); // Apply filters $title = apply_filters('wpex_title', $title); // Return title return $title; }
/** * Retrives a theme mod value and translates it * Note : Translated strings do not have any defaults in the Customizer * Because they all have localized fallbacks. * * @since 3.3.0 */ function wpex_get_translated_theme_mod($id) { return wpex_translate_theme_mod($id, wpex_get_mod($id)); }
/** * Adds js for the retina logo * * @since 1.1.0 */ function wpex_retina_logo() { // Get theme options $logo_url = wpex_get_mod('retina_logo'); $logo_height = wpex_get_mod('retina_logo_height'); // Translate theme mods $logo_url = wpex_translate_theme_mod('retina_logo', $logo_url); $logo_height = wpex_translate_theme_mod('retina_logo_height', $logo_height); // Header overlay Retina logo if (wpex_header_overlay_logo() && wpex_global_obj('has_overlay_header')) { $post_id = wpex_global_obj('post_id'); $overlay_retina_logo = get_post_meta($post_id, 'wpex_overlay_header_logo_retina', true); $overlay_retina_logo_height = get_post_meta($post_id, 'wpex_overlay_header_logo_retina_height', true); if ($overlay_retina_logo && $overlay_retina_logo_height) { if (is_numeric($overlay_retina_logo)) { $overlay_retina_logo = wp_get_attachment_image_src($overlay_retina_logo, 'full'); $overlay_retina_logo = $overlay_retina_logo[0]; } else { $overlay_retina_logo = esc_url($overlay_retina_logo); } if ($overlay_retina_logo) { $logo_url = $overlay_retina_logo; $logo_height = $overlay_retina_logo_height; } } } // Apply filters $logo_url = apply_filters('wpex_retina_logo_url', $logo_url); $logo_height = apply_filters('wpex_retina_logo_height', $logo_height); // Output JS for retina logo if ($logo_url && $logo_height) { $output = '<!-- Retina Logo --> <script type="text/javascript"> var $wpexRetinaLogo = "' . $logo_url . '", $wpexRetinaLogoHeight = "' . intval($logo_height) . '"; jQuery(function($){ if ( window.devicePixelRatio >= 2 ) { $("#site-logo img").attr("src", "' . $logo_url . '"); $("#site-logo img").css("max-height", "' . intval($logo_height) . 'px"); } }); </script>'; echo $output; } }
} else { $link_text = wpex_get_mod('callout_link_txt', 'Get In Touch'); } // If link is defined set target and rel if ($link) { // Link target $target = wpex_get_mod('callout_button_target', 'blank'); $target = 'blank' == $target ? ' target="_blank"' : ''; // Link rel $rel = wpex_get_mod('callout_button_rel', false); $rel = 'nofollow' == $rel ? ' rel="nofollow"' : ''; } // Translate Theme mods $content = wpex_translate_theme_mod('callout_text', $content); $link = wpex_translate_theme_mod('callout_link', $link); $link_text = wpex_translate_theme_mod('callout_link_txt', $link_text); ?> <div id="footer-callout-wrap" class="clr <?php echo wpex_get_mod('callout_visibility', 'always-visible'); ?> "> <div id="footer-callout" class="clr container"> <div id="footer-callout-left" class="footer-callout-content clr <?php if (!$link) { echo 'full-width'; } ?> ">
<?php /** * The template for displaying 404 pages (Not Found). * * @package Total WordPress Theme * @subpackage Templates */ get_header(); // Get custom text $wpex_error_page_text = wpex_get_mod('error_page_text'); $wpex_error_page_text = wpex_translate_theme_mod('error_page_text', $wpex_error_page_text); ?> <div id="content-wrap" class="container clr"> <?php wpex_hook_primary_before(); ?> <div id="primary" class="content-area clr"> <?php wpex_hook_content_before(); ?> <main id="content" class="clr site-content" role="main"> <?php wpex_hook_content_top(); ?>
/** * Footer bottom content * * @package Total WordPress Theme * @subpackage Partials * @version 3.0.0 */ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } // Get copyright info $copyright = wpex_get_mod('footer_copyright_text', 'Copyright <a href="#">Your Business LLC.</a> - All Rights Reserved'); // WPML translations $copyright = wpex_translate_theme_mod('footer_copyright_text', $copyright); ?> <div id="footer-bottom" class="clr"<?php wpex_schema_markup('footer_bottom'); ?> > <div id="footer-bottom-inner" class="container clr"> <?php // Display copyright info if ($copyright) { ?> <div id="copyright" class="clr" role="contentinfo">
/** * Gets correct heading for the related blog items * * @since 2.0.0 */ function wpex_blog_related_heading() { // Get heading text $heading = wpex_get_mod('blog_related_title'); // Fallback $heading = $heading ? $heading : __('Related Posts', 'wpex'); // Translate heading with WPML $heading = wpex_translate_theme_mod('blog_related_title', $heading); // Return heading return $heading; }
/** * Returns topbar content * * @since 3.0.0 */ private function top_bar_social_alt() { // Get mod $content = wpex_get_mod('top_bar_social_alt'); // Translate alternative content $content = wpex_translate_theme_mod('top_bar_social_alt', $content); // Check if social_alt is a page ID and get page content if (is_numeric($content)) { $post_id = $content; $post = get_post($post_id); if ($post && !is_wp_error($post)) { $content = $post->post_content; $this->vc_css_ids[$post_id] = $post_id; } } // Return content return $content; }
$wrap_classes .= ' container'; } ?> <section class="<?php echo $wrap_classes; ?> "> <?php // Get heading text $heading = wpex_get_mod('staff_related_title', __('Related Staff', 'wpex')); // Fallback $heading = $heading ? $heading : __('Related Staff', 'wpex'); // Translate heading with WPML $heading = wpex_translate_theme_mod('staff_related_title', $heading); // If Heading text isn't empty if ($heading) { ?> <?php // Display heading wpex_heading(array('content' => $heading, 'tag' => 'h2', 'classes' => array('related-staff-posts-heading'), 'apply_filters' => 'staff_related')); ?> <?php } ?> <div class="wpex-row clr"> <?php $wpex_count = 0; ?>
/** * Returns topbar content * * @since 3.0.0 */ private function top_bar_content() { if (!$this->has_top_bar()) { return null; } // Get topbar content from Customizer $content = wpex_get_mod('top_bar_content', '[font_awesome icon="phone" margin_right="5px" color="#000"] 1-800-987-654 [font_awesome icon="envelope" margin_right="5px" margin_left="20px" color="#000"] admin@total.com [font_awesome icon="user" margin_right="5px" margin_left="20px" color="#000"] [wp_login_url text="User Login" logout_text="Logout"]'); // Translate the content $content = wpex_translate_theme_mod('top_bar_content', $content); // Check if content is a page ID and get page content if (is_numeric($content)) { $post_id = $content; $post = get_post($post_id); if ($post && !is_wp_error($post)) { $content = $post->post_content; $this->vc_css_ids[$post_id] = $post_id; } } // Apply filters and return content return apply_filters('wpex_top_bar_content', $content); }
* * @package Total WordPress theme * @subpackage Partials * @version 3.0.0 */ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } // Vars $post_id = get_the_ID(); $format = get_post_format($post_id); $text = wpex_get_mod('blog_entry_readmore_text'); $text = $text ? $text : __('Read More', 'wpex'); // Translate readmore text with WPML $text = wpex_translate_theme_mod('blog_entry_readmore_text', $text); // Apply filters for child theming $text = apply_filters('wpex_post_readmore_link_text', $text); ?> <div class="blog-entry-readmore clr"> <a href="<?php the_permalink(); ?> " class="theme-button" title="<?php echo $text; ?> "> <?php echo $text; ?>
/** * Returns the social share heading * * @since 2.0.0 */ function wpex_social_share_heading() { $heading = wpex_get_mod('social_share_heading'); $heading = $heading ? wpex_translate_theme_mod('social_share_heading', $heading) : __('Please Share This', 'wpex'); return apply_filters('wpex_social_share_heading', $heading); }