Example #1
0
function thesis_multimedia_box()
{
    global $thesis_design;
    if ($thesis_design->multimedia_box['status']) {
        $box_type = $thesis_design->multimedia_box['status'];
    } elseif ($_GET['template']) {
        $box_type = 'image';
    }
    if (is_single() || is_page() || get_option('show_on_front') == 'page' && is_home()) {
        if (get_option('show_on_front') == 'page' && is_home()) {
            $id = get_option('page_for_posts');
        } else {
            global $post;
            $id = $post->ID;
        }
        $image = get_post_meta($id, 'thesis_image', true);
        $video = get_post_meta($id, 'thesis_video', true);
        $custom_code = get_post_meta($id, 'thesis_custom_code', true);
        $custom_hook = get_post_meta($id, 'thesis_custom_hook', true);
        $deprecated_image = get_post_meta($id, thesis_get_custom_field_key('image'), true);
        $deprecated_video = get_post_meta($id, thesis_get_custom_field_key('video'), true);
        $deprecated_custom = get_post_meta($id, thesis_get_custom_field_key('html'), true);
        if ($box_type || $image || $video || $custom_code || $custom_hook || $deprecated_image || $deprecated_video || $deprecated_custom || $_GET['template']) {
            if ($image) {
                echo "\t\t\t<div id=\"multimedia_box\" class=\"image_box\">\n" . thesis_image_box($image) . "\t\t\t</div>\n";
            } elseif ($video) {
                echo "\t\t\t<div id=\"multimedia_box\" class=\"video_box\">\n" . thesis_video_box($video) . "\t\t\t</div>\n";
            } elseif ($custom_code) {
                echo "\t\t\t<div id=\"multimedia_box\" class=\"custom_box\">\n" . thesis_custom_box($custom_code) . "\t\t\t</div>\n";
            } elseif ($custom_hook) {
                echo "\t\t\t<div id=\"multimedia_box\" class=\"custom_box\">\n" . thesis_custom_box('php') . "\t\t\t</div>\n";
            } elseif ($deprecated_image) {
                echo "\t\t\t<div id=\"multimedia_box\" class=\"image_box\">\n" . thesis_image_box($deprecated_image) . "\t\t\t</div>\n";
            } elseif ($deprecated_video) {
                echo "\t\t\t<div id=\"multimedia_box\" class=\"video_box\">\n" . thesis_video_box($deprecated_video) . "\t\t\t</div>\n";
            } elseif ($deprecated_custom) {
                echo "\t\t\t<div id=\"multimedia_box\" class=\"custom_box\">\n" . thesis_custom_box($deprecated_custom) . "\t\t\t</div>\n";
            } elseif ($box_type) {
                thesis_default_box($box_type);
            } elseif ($_GET['template']) {
                // This condition is hacky and only intended for theme previews inside WordPress
                echo "\t\t\t<div id=\"multimedia_box\" class=\"image_box\">\n" . thesis_image_box() . "\t\t\t</div>\n";
            }
            thesis_hook_after_multimedia_box();
            #hook
        }
    } elseif ($box_type) {
        thesis_default_box($box_type);
        thesis_hook_after_multimedia_box();
        #hook
    }
}
Example #2
0
function thesis_body_classes()
{
    global $thesis_design;
    $browser = $_SERVER['HTTP_USER_AGENT'];
    // Enable custom stylesheet
    if ($thesis_design->layout['custom']) {
        $classes[] = 'custom';
    }
    // Enable skin stylesheet
    /*	if ($thesis['style']['skin']) {
    		$skin_file = $thesis['style']['skin'];
    		$classes[] = str_replace('.css', '', $skin_file);
    	}*/
    // Generate per-page classes
    if (is_page() || is_single()) {
        global $post;
        $custom_slug = get_post_meta($post->ID, 'thesis_slug', true);
        $deprecated_custom_slug = get_post_meta($post->ID, thesis_get_custom_field_key('slug'), true);
        if (is_page()) {
            $classes[] = $post->post_name;
        }
        if ($custom_slug) {
            $classes[] = $custom_slug;
        } elseif ($deprecated_custom_slug) {
            $classes[] = $deprecated_custom_slug;
        }
    } elseif (is_category()) {
        $categories = thesis_get_categories(true);
        $classes[] = 'cat_' . $categories[intval(get_query_var('cat'))];
    } elseif (is_tag()) {
        $tags = thesis_get_tags(true);
        $classes[] = 'tag_' . $tags[intval(get_query_var('tag_id'))];
    } elseif (is_author()) {
        $author = thesis_get_author_data(get_query_var('author'));
        $classes[] = $author->user_nicename;
    } elseif (is_day()) {
        $classes[] = 'daily ' . strtolower(get_the_time('M_d_Y'));
    } elseif (is_month()) {
        $classes[] = 'monthly ' . strtolower(get_the_time('M_Y'));
    } elseif (is_year()) {
        $classes[] = 'year_' . strtolower(get_the_time('Y'));
    }
    $classes = apply_filters('thesis_body_classes', $classes);
    if (is_array($classes)) {
        $classes = implode(' ', $classes);
    }
    if ($classes) {
        return ' class="' . $classes . '"';
    }
}
Example #3
0
 /**
  * Compile various meta tags.
  */
 function meta()
 {
     global $thesis;
     // Public blogs need to give robots a little direction.
     if (get_option('blog_public') != 0) {
         $current_page = get_query_var('paged');
         // Should robots be allowed to index the content?
         if (is_page() || is_single()) {
             global $post;
             if (get_post_meta($post->ID, 'thesis_noindex', true)) {
                 $meta['robots'] = '<meta name="robots" content="noindex, nofollow" />';
             }
         } elseif (is_search() || is_404() || is_category() && $thesis['head']['noindex']['category'] || is_tag() && $thesis['head']['noindex']['tag'] || is_author() && $thesis['head']['noindex']['author'] || is_day() && $thesis['head']['noindex']['day'] || is_month() && $thesis['head']['noindex']['month'] || is_year() && $thesis['head']['noindex']['year'] || $current_page > 1) {
             $meta['robots'] = '<meta name="robots" content="noindex, nofollow" />';
         }
     }
     // Canonical URL
     if (!function_exists('yoast_canonical_link') && $thesis['head']['canonical'] && !is_404()) {
         if (is_single() || is_page()) {
             global $post;
             $url = is_page() && get_option('show_on_front') == 'page' && get_option('page_on_front') == $post->ID ? trailingslashit(get_permalink()) : get_permalink();
         } elseif (is_author()) {
             $author = get_userdata(get_query_var('author'));
             $url = get_author_link(false, $author->ID, $author->user_nicename);
         } elseif (is_category()) {
             $url = get_category_link(get_query_var('cat'));
         } elseif (is_tag()) {
             $tag = get_term_by('slug', get_query_var('tag'), 'post_tag');
             if (!empty($tag->term_id)) {
                 $url = get_tag_link($tag->term_id);
             }
         } elseif (is_day()) {
             $url = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day'));
         } elseif (is_month()) {
             $url = get_month_link(get_query_var('year'), get_query_var('monthnum'));
         } elseif (is_year()) {
             $url = get_year_link(get_query_var('year'));
         } elseif (is_home()) {
             $url = get_option('show_on_front') == 'page' ? trailingslashit(get_permalink(get_option('page_for_posts'))) : trailingslashit(get_option('home'));
         }
         $meta['canonical'] = '<link rel="canonical" href="' . $url . '" />';
     }
     // Is All-in-One SEO installed? If so, defer to it for SEO meta handling.
     if (!class_exists('All_in_One_SEO_Pack')) {
         if (is_single() || is_page()) {
             global $post;
             $custom_description = get_post_meta($post->ID, 'thesis_description', true);
             $deprecated_custom_meta = get_post_meta($post->ID, thesis_get_custom_field_key('meta'), true);
             $excerpt = trim(strip_tags(wp_specialchars($post->post_excerpt)));
             $custom_keywords = get_post_meta($post->ID, 'thesis_keywords', true);
             $deprecated_custom_keywords = get_post_meta($post->ID, thesis_get_custom_field_key('keywords'), true);
             if (strlen($custom_description)) {
                 $meta['description'] = '<meta name="description" content="' . trim(wptexturize(strip_tags(stripslashes($custom_description)))) . '" />';
             } elseif (strlen($deprecated_custom_meta)) {
                 $meta['description'] = '<meta name="description" content="' . trim(wptexturize(strip_tags(stripslashes($deprecated_custom_meta)))) . '" />';
             } elseif (strlen($excerpt)) {
                 $meta['description'] = '<meta name="description" content="' . $excerpt . '" />';
             }
             if (strlen($custom_keywords)) {
                 $meta['keywords'] = '<meta name="keywords" content="' . trim(wptexturize(strip_tags(stripslashes($custom_keywords)))) . '" />';
             } elseif (strlen($deprecated_custom_keywords)) {
                 $meta['keywords'] = '<meta name="keywords" content="' . trim(wptexturize(strip_tags(stripslashes($deprecated_custom_keywords)))) . '" />';
             } else {
                 $tags = thesis_get_post_tags($post->ID);
                 if ($tags) {
                     $meta['keywords'] = '<meta name="keywords" content="' . implode(', ', $tags) . '" />';
                 }
             }
         } elseif (is_category()) {
             $category_description = trim(strip_tags(stripslashes(category_description())));
             $meta['description'] = strlen($category_description) ? '<meta name="description" content="' . $category_description . '" />' : '<meta name="description" content="' . single_cat_title('', false) . '" />';
         } else {
             if ($thesis['home']['meta']['description']) {
                 $meta['description'] = '<meta name="description" content="' . trim(wptexturize(strip_tags(stripslashes($thesis['home']['meta']['description'])))) . '" />';
             } elseif (strlen(get_bloginfo('description'))) {
                 $meta['description'] = '<meta name="description" content="' . get_bloginfo('description') . '" />';
             }
             if ($thesis['home']['meta']['keywords']) {
                 $meta['keywords'] = '<meta name="keywords" content="' . $thesis['home']['meta']['keywords'] . '" />';
             }
         }
     }
     if ($thesis['head']['version']) {
         $meta['version'] = '<meta name="wp_theme" content="Thesis ' . thesis_get_theme_version() . '" />';
     }
     if ($meta) {
         $this->meta = $meta;
     }
 }
Example #4
0
 function meta()
 {
     global $thesis_site;
     global $thesis_pages;
     // robots meta
     if (get_option('blog_public') != 0) {
         #wp
         $noindex = $thesis_site->head['meta']['robots']['noindex'];
         $nofollow = $thesis_site->head['meta']['robots']['nofollow'];
         $noarchive = $thesis_site->head['meta']['robots']['noarchive'];
         if (is_home() && get_query_var('paged') > 1) {
             #wp
             $page_type = 'sub';
         } elseif (is_author()) {
             #wp
             $page_type = 'author';
         } elseif (is_day()) {
             #wp
             $page_type = 'day';
         } elseif (is_month()) {
             #wp
             $page_type = 'month';
         } elseif (is_year()) {
             #wp
             $page_type = 'year';
         }
         if (!$page_type && (is_home() || is_front_page())) {
             if (get_option('show_on_front') == 'page' && is_front_page()) {
                 #wp
                 $page_id = get_option('page_on_front');
             } elseif (get_option('show_on_front') == 'page' && is_home()) {
                 #wp
                 $page_id = get_option('page_for_posts');
             }
             #wp
             $robots_meta = $page_id ? get_post_meta($page_id, 'thesis_robots', true) : $thesis_pages->home['head']['meta']['robots'];
             if ($page_id) {
                 $robots_deprecated = get_post_meta($page_id, 'thesis_noindex', true);
             }
             if (is_array($robots_meta)) {
                 foreach ($robots_meta as $meta_tag => $value) {
                     if ($value) {
                         $content[] = $meta_tag;
                     }
                 }
             } elseif ($robots_deprecated) {
                 $content[] = 'noindex';
             }
         } elseif (!$page_type && (is_page() || is_single())) {
             #wp
             global $post;
             #wp
             $robots_meta = get_post_meta($post->ID, 'thesis_robots', true);
             #wp
             $robots_deprecated = get_post_meta($post->ID, 'thesis_noindex', true);
             #wp
             if (is_array($robots_meta)) {
                 foreach ($robots_meta as $meta_tag => $value) {
                     if ($value) {
                         $content[] = $meta_tag;
                     }
                 }
             } elseif ($robots_deprecated) {
                 $content[] = 'noindex';
             }
         } elseif (is_category()) {
             #wp
             global $wp_query;
             #wp
             $cat_noindex = $thesis_pages->categories[$wp_query->query_vars['cat']]['head']['meta']['robots']['noindex'];
             $cat_nofollow = $thesis_pages->categories[$wp_query->query_vars['cat']]['head']['meta']['robots']['nofollow'];
             $cat_noarchive = $thesis_pages->categories[$wp_query->query_vars['cat']]['head']['meta']['robots']['noarchive'];
             if (isset($cat_noindex) && $cat_noindex || !isset($cat_noindex) && $noindex['category']) {
                 $content[] = 'noindex';
             }
             if (isset($cat_nofollow) && $cat_nofollow || !isset($cat_nofollow) && $nofollow['category']) {
                 $content[] = 'nofollow';
             }
             if (isset($cat_noarchive) && $cat_noarchive || !isset($cat_noarchive) && $noarchive['category']) {
                 $content[] = 'noarchive';
             }
         } elseif (is_tag()) {
             #wp
             global $wp_query;
             #wp
             $tag_noindex = $thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['meta']['robots']['noindex'];
             $tag_nofollow = $thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['meta']['robots']['nofollow'];
             $tag_noarchive = $thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['meta']['robots']['noarchive'];
             if (isset($tag_noindex) && $tag_noindex || !isset($tag_noindex) && $noindex['tag']) {
                 $content[] = 'noindex';
             }
             if (isset($tag_nofollow) && $tag_nofollow || !isset($tag_nofollow) && $nofollow['tag']) {
                 $content[] = 'nofollow';
             }
             if (isset($tag_noarchive) && $tag_noarchive || !isset($tag_noarchive) && $noarchive['tag']) {
                 $content[] = 'noarchive';
             }
         } elseif (is_search() || is_404()) {
             #wp
             $content[] = 'noindex, nofollow, noarchive';
         } elseif ($page_type) {
             if ($noindex[$page_type]) {
                 $content[] = 'noindex';
             }
             if ($nofollow[$page_type]) {
                 $content[] = 'nofollow';
             }
             if ($noarchive[$page_type]) {
                 $content[] = 'noarchive';
             }
         }
         if ($thesis_site->head['meta']['robots']['noodp']) {
             $content[] = 'noodp';
         }
         if ($thesis_site->head['meta']['robots']['noydir']) {
             $content[] = 'noydir';
         }
         $meta['robots'] = $content ? '<meta name="robots" content="' . implode(', ', $content) . '" />' : false;
     }
     // meta description and keywords
     if (!class_exists('All_in_One_SEO_Pack')) {
         if (is_home() || is_front_page()) {
             if (get_option('show_on_front') == 'page' && is_front_page()) {
                 #wp
                 $page_id = get_option('page_on_front');
             } elseif (get_option('show_on_front') == 'page' && is_home()) {
                 #wp
                 $page_id = get_option('page_for_posts');
             }
             #wp
             $keywords = $page_id ? get_post_meta($page_id, 'thesis_keywords', true) : urldecode($thesis_pages->home['head']['meta']['keywords']);
             if ($page_id && !get_post_meta($page_id, 'thesis_no_description', true)) {
                 $description = strip_tags(stripslashes(get_post_meta($page_id, 'thesis_description', true)));
             } else {
                 $description = $thesis_pages->home['head']['meta']['description'] ? urldecode($thesis_pages->home['head']['meta']['description']) : get_bloginfo('description');
             }
             if ($description) {
                 $meta['description'] = '<meta name="description" content="' . trim(wptexturize($description)) . '" />';
             }
             #wp
             if ($keywords) {
                 $meta['keywords'] = '<meta name="keywords" content="' . trim(wptexturize($keywords)) . '" />';
             }
         } elseif (is_single() || is_page()) {
             #wp
             global $post;
             #wp
             $no_description = get_post_meta($post->ID, 'thesis_no_description', true);
             #wp
             $description = get_post_meta($post->ID, 'thesis_description', true);
             #wp
             $deprecated_description = get_post_meta($post->ID, thesis_get_custom_field_key('meta'), true);
             #wp
             $keywords = get_post_meta($post->ID, 'thesis_keywords', true);
             #wp
             $deprecated_keywords = get_post_meta($post->ID, thesis_get_custom_field_key('keywords'), true);
             #wp
             if (!$no_description) {
                 if (strlen($description)) {
                     $meta['description'] = '<meta name="description" content="' . trim(wptexturize(strip_tags(stripslashes($description)))) . '" />';
                 } elseif (strlen($deprecated_description)) {
                     $meta['description'] = '<meta name="description" content="' . trim(wptexturize(strip_tags(stripslashes($deprecated_description)))) . '" />';
                 } else {
                     setup_postdata($post);
                     #wp
                     add_filter('excerpt_length', 'thesis_meta_excerpt_length');
                     #wp #filter
                     $excerpt = trim(str_replace('[...]', '', wp_trim_excerpt('')));
                     #wp
                     remove_filter('excerpt_length', 'thesis_meta_excerpt_length');
                     #wp
                     $meta['description'] = '<meta name="description" content="' . $excerpt . '" />';
                 }
             }
             if (strlen($keywords)) {
                 $meta['keywords'] = '<meta name="keywords" content="' . trim(wptexturize(strip_tags(stripslashes($keywords)))) . '" />';
             } elseif (strlen($deprecated_keywords)) {
                 $meta['keywords'] = '<meta name="keywords" content="' . trim(wptexturize(strip_tags(stripslashes($deprecated_keywords)))) . '" />';
             } else {
                 $tags = thesis_get_post_tags($post->ID);
                 if ($tags) {
                     $meta['keywords'] = '<meta name="keywords" content="' . implode(', ', $tags) . '" />';
                 }
             }
         } elseif (is_category() || is_tag()) {
             #wp
             global $wp_query;
             #wp
             $description = is_category() ? urldecode($thesis_pages->categories[$wp_query->query_vars['cat']]['head']['meta']['description']) : urldecode($thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['meta']['description']);
             #wp
             $keywords = is_category() ? urldecode($thesis_pages->categories[$wp_query->query_vars['cat']]['head']['meta']['keywords']) : urldecode($thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['meta']['keywords']);
             #wp
             if ($description) {
                 $meta['description'] = '<meta name="description" content="' . trim(wptexturize($description)) . '" />';
             }
             #wp
             if ($keywords) {
                 $meta['keywords'] = '<meta name="keywords" content="' . trim(wptexturize($keywords)) . '" />';
             }
             #wp
         }
     }
     if ($meta) {
         $this->meta = $meta;
     }
 }