function is_page_check() { global $wp_query; if (is_static()) { status_header(200); $wp_query->is_404 = false; $wp_query->is_static = true; } if (is_single()) { the_post(); } }
function get_head_meta($name = null) { global $post; global $_SITE; global $_PAGES; if ($name == 'author') { return $_SITE['author']; } if (is_home()) { $meta = array('title' => strip_tags(isset($_SITE['title']) ? $_SITE['title'] : get_bloginfo('name')), 'url' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'description' => strip_tags(isset($_SITE['description']) ? $_SITE['description'] : get_bloginfo('description')), 'image' => $_SITE['image'], 'site_name' => $_SITE['site_name'], 'type' => 'website'); } else { if (is_single()) { $title = get_the_title(); $desc = get_post_main_desc($post->ID); $image = get_post_main_image($post->ID); $meta = array('title' => strip_tags((isset($title) ? $title . ' | ' : '') . $_SITE['title']), 'url' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'description' => str_replace(array("\r\n", "\n", "\r"), '', strip_tags(isset($desc) ? $desc : $_SITE['description'])), 'image' => isset($image) ? $image : $_SITE['image'], 'site_name' => $_SITE['site_name'], 'type' => 'article'); } else { if ((is_static() or is_page()) and isset($_PAGES[get_page_slug()])) { $p = $_PAGES[get_page_slug()]; $image = !empty($p['image']) ? $p['image'] : $_SITE['image']; $desc = !empty($p['description']) ? $p['description'] : $_SITE['description']; $meta = array('title' => $p['title'] . ' | ' . $_SITE['title'], 'url' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'description' => $desc, 'image' => $image, 'site_name' => $_SITE['site_name'], 'type' => 'article'); } else { if (is_page()) { $title = get_the_title(); $desc = get_the_excerpt(); $image = get_post_main_image($post->ID); $meta = array('title' => (!empty($title) ? $title . ' | ' : '') . $_SITE['title'], 'url' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'description' => !empty($desc) ? $desc : $_SITE['description'], 'image' => isset($image) ? $image : $_SITE['image'], 'site_name' => $_SITE['site_name'], 'type' => 'article'); } else { if (is_tax()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); $image = function_exists('get_field') ? get_field('term_thumb', $term) : null; $meta = array('title' => (!empty($term) ? $term->name . ' | ' : '') . $_SITE['title'], 'url' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'description' => !empty($term) ? $term->description : $_SITE['description'], 'image' => !empty($image) ? $image['url'] : $_SITE['image'], 'site_name' => $_SITE['site_name'], 'type' => 'article'); } else { $meta = array('title' => $_SITE['title'], 'url' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'description' => $_SITE['description'], 'image' => $_SITE['image'], 'site_name' => $_SITE['site_name'], 'type' => 'article'); } } } } } $meta = array_merge($_SITE, $meta); return isset($name) && isset($meta[$name]) ? $meta[$name] : $meta; }