/** * Retrieve current page keywords and description and return them. * * @return string * @since 1.0.0 */ function yit_get_meta_tags() { global $post; ob_start(); ?> <meta charset="<?php bloginfo('charset'); ?> " /> <?php if (yit_get_option('responsive-enabled')) { ?> <!-- this line will appear only if the website is visited with an iPad --> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.2, user-scalable=yes" /> <?php } ?> <?php $post_type = isset($post->post_type) ? $post->post_type : ''; $post_id = yit_post_id(); yit_og_meta_tags($post_id); if ($post_id) { //Keywords and description use apposite SEO option $keywords = !empty($post_type) ? yit_get_post_meta($post_id, '_seo-keywords') : ''; $description = !empty($post_type) ? yit_get_post_meta($post_id, '_seo-description') : ''; $keywords = empty($keywords) ? yit_get_option($post_type . '-seo-keywords') : $keywords; $keywords = empty($keywords) ? yit_get_option('seo-keywords') : $keywords; $description = empty($description) ? yit_get_option($post_type . '-seo-description') : $description; $description = empty($description) ? yit_get_option('seo-description') : $description; if (!empty($keywords)) { ?> <meta name="keywords" content="<?php echo $keywords; ?> " /><?php } if (!empty($description)) { ?> <meta name="description" content="<?php echo $description; ?> " /><?php } } ?> <?php return ob_get_clean(); }
<?php /** * Your Inspiration Themes * * @package WordPress * @subpackage Your Inspiration Themes * @author Your Inspiration Themes Team <*****@*****.**> * * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.gnu.org/licenses/gpl-3.0.txt */ $bg_slider = yit_get_post_meta(yit_post_id(), '_bg_slider'); echo do_shortcode('[slider name="' . $bg_slider . '"]');
/** * Define the body background for the page. * * First get the setting for the current page. If a setting is not defined * in the current page, will be get the setting from the theme options. * All css will be shown in head tag, by the action 'wp_head' * * @since 1.0.0 */ function yit_body_background() { $post_id = yit_post_id(); // get color and background from postmeta $color = yit_get_post_meta($post_id, '_bg_color', true); $image = yit_get_post_meta($post_id, '_bg_image', true); // get the color and background from theme options, if above are empty $background = yit_get_option('background-style'); if (empty($image) && empty($color)) { $image = $background['image']; if ($image == 'custom') { $image = yit_get_option('bg_image'); } } if (empty($color)) { $color = $background['color']; } $image_repeat = yit_get_option('bg_image_repeat'); $image_position = yit_get_option('bg_image_position'); $image_attachment = yit_get_option('bg_image_attachment'); $css = array(); if (!empty($color)) { $css[] = "background-color: {$color};"; } if (!empty($image) && $image != 'none') { $css[] = "background-image: url('{$image}');"; } if (!empty($image) && !empty($image_repeat)) { $css[] = "background-repeat: {$image_repeat};"; } if (!empty($image) && !empty($image_position)) { $css[] = "background-position: {$image_position};"; } if (!empty($image) && !empty($image_attachment)) { $css[] = "background-attachment: {$image_attachment};"; } if (empty($css)) { return; } ?> <style type="text/css"> body { <?php echo implode(' ', $css); ?> } </style> <?php }
* Your Inspiration Themes * * @package WordPress * @subpackage Your Inspiration Themes * @author Your Inspiration Themes Team <*****@*****.**> * * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.gnu.org/licenses/gpl-3.0.txt */ global $post; if (!isset($post->ID)) { return; } $post_id = yit_post_id(); $show_title = is_page() ? yit_get_post_meta($post_id, '_show-title') : false; $show_breadcrumb = is_page() ? yit_get_post_meta($post_id, '_show-breadcrumb') : (bool) yit_get_option('breadcrumb'); if ($show_title || $show_breadcrumb) { $tag_title = apply_filters('yit_page_slogan_tag', 'h1'); ?> <!-- START PAGE META --> <div id="page-meta" class="group margin-top"> <div class="container"> <div class="row"> <div class="span12"> <?php if ($show_title) { ?> <!-- TITLE --> <div class="title">
/** * Retrieve the sidebar settings for the current post. * * @param string $setting * @return string * @since 1.0.0 */ function yit_get_sidebar_setting() { global $post, $yit_sidebar_layout; global $wp_query; $post_id = yit_post_id(); if (empty($post_id) || is_category() || is_archive() || is_search()) { $yit_sidebar_layout = yit_get_standard_sidebar(); return; } else { $sidebar_layout = yit_get_post_meta($post_id, '_sidebar-layout'); if (!empty($sidebar_layout) && isset($sidebar_layout['sidebar']) && $sidebar_layout['sidebar'] != -1 || isset($sidebar_layout["layout"]) && $sidebar_layout["layout"] == 'sidebar-no') { $yit_sidebar_layout = $sidebar_layout; } else { $yit_sidebar_layout = yit_get_standard_sidebar(); } } }
/** * Create the title of the current page based on SEO options. * * @return string * @since 1.0.0 */ function yit_get_title() { global $post, $page, $paged; if (!function_exists('is_plugin_active')) { require_once ABSPATH . "/wp-admin/includes/plugin.php"; } $post_type = isset($post->post_type) ? $post->post_type : ''; $post_id = yit_post_id(); if ($post_id) { //Title uses apposite SEO option. If it is empty, the normal title will be used. if (!empty($post_type)) { $title = yit_get_post_meta($post_id, '_seo-title'); } if (empty($title)) { $title = yit_get_option($post_type . '-seo-title'); } if (empty($title)) { $title = yit_get_option('seo-title'); } if (empty($title)) { $title = wp_title('|', false, 'right'); if (!is_plugin_active('wordpress-seo/wp-seo.php')) { if (!is_home() && !is_front_page()) { $title .= ' | '; } $title .= yit_remove_chars_title(get_bloginfo('name')); // Add description, if is home if (is_home() || is_front_page()) { $title .= ' | ' . yit_remove_chars_title(get_bloginfo('description')); } } } } else { $title = wp_title('|', false, 'right'); $title .= yit_remove_chars_title(get_bloginfo('name')); if (!is_plugin_active('wordpress-seo/wp-seo.php')) { // Add description, if is home if (is_home() || is_front_page()) { $title .= ' | ' . yit_remove_chars_title(get_bloginfo('description')); } } } // Add a page number if necessary: if ($paged >= 2 || $page >= 2) { $title .= ' | ' . sprintf(__('Page %s', 'yit'), max($paged, $page)); } return apply_filters('yit_title', $title); }
function yit_load_bg_slider() { $bg_slider = yit_get_post_meta(yit_post_id(), '_bg_slider'); if (empty($bg_slider) || $bg_slider == 'none') { return; } yit_add_body_class('background-slider'); add_action('wp_head', 'yit_bg_slider'); }
/** * Get the name of the slider defined in the page * * @return string * * @since 1.0 */ function yit_slider_name() { global $post, $wp_query; $slider = ''; $post_id = yit_post_id(); if ( $post_id != 0 ) $slider = get_post_meta( $post_id, '_slider_name', true ); if ( empty( $slider ) && ! $wp_query->is_posts_page && ( is_home() || is_front_page() ) ) { $slider = yit_get_option( 'slider_name', 'none' ); } if ( empty( $slider ) ) $slider = 'none'; return $slider; }