function title() { if (is_category()) { echo 'Category Archive for "'; single_cat_title(); echo '" | '; bloginfo('name'); } elseif (is_tag()) { echo 'Tag Archive for "'; single_tag_title(); echo '" | '; bloginfo('name'); } elseif (is_archive()) { wp_title(''); echo ' Archive | '; bloginfo('name'); } elseif (is_search()) { echo 'Search for "' . wp_specialchars($s) . '" | '; bloginfo('name'); } elseif (is_home() || is_front_page()) { bloginfo('name'); echo ' | '; bloginfo('description'); } elseif (is_404()) { echo 'Error 404 Not Found | '; bloginfo('name'); } elseif (is_single()) { wp_title(''); } else { echo wp_title(' | ', false, right); bloginfo('name'); } }
function theme_description() { global $s, $post; $description = ''; $blog_name = get_bloginfo('name'); if (is_singular()) { if (!empty($post->post_excerpt)) { $text = $post->post_excerpt; } else { $text = $post->post_content; } $description = trim(str_replace(array("\r\n", "\r", "\n", " ", " "), " ", str_replace("\"", "'", strip_tags($text)))); if (!$description) { $description = $blog_name . "-" . trim(wp_title('', false)); } } elseif (is_home()) { $description = $blog_name . "-" . get_bloginfo('description') . '|' . dopt('Rcloud_description'); // 首頁要自己加 } elseif (is_tag()) { $description = $blog_name . "有关 '" . single_tag_title('', false) . "' 的文章"; } elseif (is_category()) { $description = $blog_name . "有关 '" . single_cat_title('', false) . "' 的文章"; } elseif (is_archive()) { $description = $blog_name . "在: '" . trim(wp_title('', false)) . "' 的文章"; } elseif (is_search()) { $description = $blog_name . ": '" . esc_html($s, 1) . "' 的搜索結果"; } else { $description = $blog_name . "有关 '" . trim(wp_title('', false)) . "' 的文章"; } $description = mb_substr($description, 0, 220, 'utf-8') . '..'; echo "<meta name=\"description\" content=\"{$description}\" />\n"; }
/** * Retrieve the blog title for the feed title. * * @package WordPress * @subpackage Feed * @since 2.2.0 * @uses apply_filters() Calls 'get_wp_title_rss' hook on title. * @uses wp_title() See function for $sep parameter usage. * * @param string $sep Optional.How to separate the title. See wp_title() for more info. * @return string Error message on failure or blog title on success. */ function get_wp_title_rss($sep = '»') { $title = wp_title($sep, false); if ( is_wp_error( $title ) ) return $title->get_error_message(); $title = apply_filters('get_wp_title_rss', $title); return $title; }
/** * Output the site page title * @access public * @subpackage Framework/Head * @return void */ function df_page_title($title) { $title = '<title>' . get_bloginfo('name') . ' | '; $title .= is_home() ? get_bloginfo('description') : wp_title('', false); $title .= '</title>'; echo apply_filters('df_page_title', $title); }
public function wp_head() { if (is_question()) { global $wp; echo '<link href="' . home_url(add_query_arg(array(), $wp->request)) . '" title="' . wp_title('|', false, 'right') . '" type="application/rss+xml" rel="alternate">'; } }
function rt_breadcrumb($gecerli_sayfa) { if (is_page()) { $ust_id = $gecerli_sayfa->post_parent; $yeni_sorgu = get_post($ust_id); if ($yeni_sorgu->post_parent) { rt_breadcrumb($yeni_sorgu); echo " \\ "; } echo "<a href=\"" . get_permalink($yeni_sorgu->ID) . "\" title=\"\" >" . get_the_title($yeni_sorgu->ID) . "</a>"; } elseif (is_single() || is_category() && !is_archive()) { $ust_id = $gecerli_sayfa->post_parent; $yeni_sorgu = get_post($ust_id); $kategori = get_the_category($yeni_sorgu->ID); $ID = $kategori[0]->cat_ID; $ayrac = " \ "; echo get_category_parents($ID, TRUE, $ayrac, FALSE); if ($yeni_sorgu->post_parent) { rt_breadcrumb($yeni_sorgu); if (!is_category()) { echo " \\ "; } } if (is_single()) { echo "<a href=\"" . get_permalink($yeni_sorgu->ID) . "\" title=\"\" >" . get_the_title($yeni_sorgu->ID) . "</a>"; } } else { echo wp_title(''); } }
/** * Site meta, title, and favicon * in header.php * * @since 1.0.0 */ function reactor_do_reactor_head() { ?> <meta charset="<?php bloginfo('charset'); ?> " /> <title><?php wp_title('|', true, 'right'); ?> </title> <!-- google chrome frame for ie --> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <!-- mobile meta --> <meta name="HandheldFriendly" content="True"> <meta name="MobileOptimized" content="320"> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <?php $favicon_uri = reactor_option('favicon_image') ? reactor_option('favicon_image') : get_template_directory_uri() . '/favicon.ico'; ?> <link rel="shortcut icon" href="<?php echo $favicon_uri; ?> "> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?> "> <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700' rel='stylesheet' type='text/css'> <?php }
function A2A_SHARE_SAVE_link_vars($linkname = false, $linkurl = false, $linkmedia = false, $use_current_page = false) { global $post; // Set linkname if (!$linkname) { if ($use_current_page) { $linkname = is_home() || is_front_page() ? get_bloginfo('name') : rtrim(wp_title('', false, 'right')); } elseif (isset($post)) { $linkname = html_entity_decode(strip_tags(get_the_title($post->ID)), ENT_QUOTES, 'UTF-8'); } else { $linkname = ''; } } $linkname_enc = rawurlencode($linkname); // Set linkurl if (!$linkurl) { if ($use_current_page) { $linkurl = esc_url_raw((is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); } elseif (isset($post)) { $linkurl = get_permalink($post->ID); } else { $linkurl = ''; } } $linkurl_enc = rawurlencode($linkurl); // Set linkmedia (only applies to services that explicitly accept media; Pinterest does, most do not) $linkmedia_enc = !empty($linkmedia) ? rawurlencode($linkmedia) : false; return compact('linkname', 'linkname_enc', 'linkurl', 'linkurl_enc', 'linkmedia', 'linkmedia_enc'); }
/** * Initializes this object to default data */ public function __construct() { $tempate_directory_uri = get_template_directory_uri(); $title = get_bloginfo('name') . wp_title(null, false); $description = get_bloginfo('description'); $this->set_title($title)->set_meta_tag(array('name' => 'description', 'content' => $description))->set_meta_tag(array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'))->set_charset(get_bloginfo('charset'))->set_link(array('rel' => 'shortcut icon', 'href' => "{$tempate_directory_uri}/images/favicon.png")); }
function breadcrumbs() { $theFullUrl = $_SERVER["REQUEST_URI"]; $urlArray = explode("/", $theFullUrl); //echo 'You Are Here: <a href="/">Home</a>'; echo "<div class='breadcrumbs_div'>"; echo "<div class='breadcrumbs'><ul>"; while (list($j, $text) = each($urlArray)) { $dir = ''; if ($j > 1) { $i = 1; while ($i < $j) { $dir .= '/' . $urlArray[$i]; $text = $urlArray[$i]; $i++; } if ($j < count($urlArray) - 1) { echo ' <li><a href="' . $dir . '">' . str_replace("-", " ", $text) . '</a></li>'; } } } echo "</ul></div>"; echo "<div class='current'>" . wp_title('', false) . '<img class="current_img" width="11" height="17" border="0" src="/wp-content/themes/crikey/img/left_arrow.png" alt=">">' . "</div></div>"; echo '<div class="clear"></div>'; }
/** * Prints better page title */ function perfect_title() { echo '<title>'; if (function_exists('is_tag') && is_tag()) { single_tag_title(__('Tag Archive for') . '"'); $output .= '" - '; } elseif (is_archive()) { wp_title(''); echo __('Archive') . ' - '; } elseif (is_search()) { echo __('Search for') . '"' . esc_html($s) . '" - '; } elseif (!is_404() && is_single() || is_page()) { wp_title(''); echo ' - '; } elseif (is_404()) { echo __('Not Found') . '-'; } if (is_home()) { bloginfo('name'); echo ' - '; bloginfo('description'); } else { bloginfo('name'); } if ($paged > 1) { echo ' - ' . __('page') . ' ' . $paged; } echo '</title>'; }
/** * Returns the document title. * * The order (site name first or last) can be set on the Tarski Options page. * While the function ultimately returns a string, please note that filters * are applied to an array! This allows plugins to easily alter any aspect * of the title. For example, one might write a plugin to change the separator. * * @since 1.5 * @deprecated 3.2.0 * * @param string $sep * @return string * * @hook filter tarski_doctitle * Filter document titles. */ function tarski_doctitle($sep = '·') { _deprecated_function('wp_title', '3.2.0'); $site_name = get_bloginfo('name'); $content = trim(wp_title('', false)); if (is_404()) { $content = sprintf(__('Error %s', 'tarski'), '404'); } elseif (get_option('show_on_front') == 'posts' && is_home()) { $content = get_bloginfo('description', 'display'); } elseif (is_search()) { $content = sprintf(__('Search results for %s', 'tarski'), esc_html(get_search_query())); } elseif (is_month()) { $content = single_month_title(' ', false); } elseif (is_tag()) { $content = multiple_tag_titles(); } $elements = strlen($content) > 0 ? array('site_name' => $site_name, 'separator' => $sep, 'content' => $content) : array('site_name' => $site_name); if (get_tarski_option('swap_title_order')) { $elements = array_reverse($elements, true); } // Filters should return an array $elements = apply_filters('tarski_doctitle', $elements); // But if they don't, it won't try to implode if (is_array($elements)) { $doctitle = implode(' ', $elements); } echo $doctitle; }
/** * Enqueue scripts and styles */ function add_scripts() { if (empty($GLOBALS['posts']) || !is_array($GLOBALS['posts'])) { return; } foreach ($GLOBALS['posts'] as $p) { if (has_shortcode($p->post_content, 'recipe')) { $this->scripts_and_style_included = true; break; } } if (!$this->scripts_and_style_included) { return; } if (is_rtl()) { wp_enqueue_style('jetpack-recipes-style', plugins_url('/css/rtl/recipes-rtl.css', __FILE__), array(), '20130919'); } else { wp_enqueue_style('jetpack-recipes-style', plugins_url('/css/recipes.css', __FILE__), array(), '20130919'); } wp_enqueue_script('jetpack-recipes-printthis', plugins_url('/js/recipes-printthis.js', __FILE__), array('jquery'), '20131230'); wp_enqueue_script('jetpack-recipes-js', plugins_url('/js/recipes.js', __FILE__), array('jquery', 'jetpack-recipes-printthis'), '20131230'); $title_var = wp_title('|', false, 'right'); $print_css_var = plugins_url('/css/recipes-print.css', __FILE__); wp_localize_script('jetpack-recipes-js', 'jetpack_recipes_vars', array('pageTitle' => $title_var, 'loadCSS' => $print_css_var)); }
/** * tarski_doctitle() - Returns the document title. * * The order (site name first or last) can be set on the Tarski Options page. * While the function ultimately returns a string, please note that filters * are applied to an array! This allows plugins to easily alter any aspect * of the title. For example, one might write a plugin to change the separator. * @since 1.5 * @param string $sep * @return string $doctitle * @hook filter tarski_doctitle * Filter document titles. */ function tarski_doctitle($sep = '·') { $site_name = get_bloginfo('name'); if (is_404()) { $content = __(sprintf('Error %s', '404'), 'tarski'); } elseif (get_option('show_on_front') == 'posts' && is_home()) { if (get_bloginfo('description')) { $content = get_bloginfo('description'); } } elseif (is_search()) { $content = sprintf(__('Search results for %s', 'tarski'), attribute_escape(get_search_query())); } elseif (is_month()) { $content = single_month_title(' ', false); } elseif (is_tag()) { $content = multiple_tag_titles(); } else { $content = trim(wp_title('', false)); } if ($content) { $elements = array('site_name' => $site_name, 'separator' => $sep, 'content' => $content); } else { $elements = array('site_name' => $site_name); } if (get_tarski_option('swap_title_order')) { $elements = array_reverse($elements, true); } // Filters should return an array $elements = apply_filters('tarski_doctitle', $elements); // But if they don't, it won't try to implode if (check_input($elements, 'array')) { $doctitle = implode(' ', $elements); } echo $doctitle; }
public static function set_cookie($data = '') { $data = wp_parse_args($data, array('query' => json_encode($GLOBALS['wp_query']->query), 'url' => (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'title' => trim(wp_title(self::SEP, false, 'left')))); foreach ($data as $key => $value) { setcookie(self::get_name($key), $value, 0, '/'); } }
function meta_title() { if (is_single()) { single_post_title(); echo ' | '; bloginfo('name'); } elseif (is_home() || is_front_page()) { bloginfo('name'); if (get_bloginfo('description')) { echo ' | '; bloginfo('description'); get_page_number(); } } elseif (is_page()) { single_post_title(''); echo ' | '; bloginfo('name'); } elseif (is_search()) { printf(__('有关 %s 的搜索结果:'), '"' . get_search_query() . '"'); get_page_number(); echo ' | '; bloginfo('name'); } elseif (is_404()) { _e('404 Not Found', 'Arnold'); echo ' | '; bloginfo('name'); } else { wp_title(''); echo ' | '; bloginfo('name'); get_page_number(); } }
function apt_simple_title() { if (!is_front_page()) { echo trim(wp_title('', false)) . " | "; } bloginfo('name'); }
function title() { global $thesis_site, $thesis_pages; $site_name = get_bloginfo('name'); #wp $separator = $thesis_site->head['title']['separator'] ? urldecode($thesis_site->head['title']['separator']) : '—'; if (is_home() || is_front_page()) { #wp $tagline = get_bloginfo('description'); #wp $home_title = $thesis_pages->home['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->home['head']['title']))) : "{$site_name} {$separator} {$tagline}"; #wp if (get_option('show_on_front') == 'page' && is_front_page()) { #wp $page_title = get_post_meta(get_option('page_on_front'), 'thesis_title', true); } elseif (get_option('show_on_front') == 'page' && is_home()) { #wp $page_title = get_post_meta(get_option('page_for_posts'), 'thesis_title', true); } #wp $output = $page_title ? trim(wptexturize(strip_tags(stripslashes($page_title)))) : $home_title; #wp } elseif (is_category()) { #wp global $wp_query; #wp $category_title = $thesis_pages->categories[$wp_query->query_vars['cat']]['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->categories[$wp_query->query_vars['cat']]['head']['title']))) : single_cat_title('', false); #wp $output = $thesis_site->head['title']['branded'] ? "{$category_title} {$separator} {$site_name}" : $category_title; } elseif (is_tag()) { global $wp_query; #wp $tag_title = $thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['title']))) : single_tag_title('', false); #wp $output = $thesis_site->head['title']['branded'] ? "{$tag_title} {$separator} {$site_name}" : $tag_title; } elseif (is_search()) { #wp $search_title = __('You searched for', 'thesis') . ' “' . attribute_escape(get_search_query()) . '”'; #wp $output = $thesis_site->head['title']['branded'] ? "{$search_title} {$separator} {$site_name}" : $search_title; } else { global $post; #wp $custom_title = is_single() || is_page() ? trim(wptexturize(strip_tags(stripslashes(get_post_meta($post->ID, 'thesis_title', true))))) : false; #wp $page_title = $custom_title ? $custom_title : trim(wp_title('', false)); #wp $output = $thesis_site->head['title']['branded'] ? "{$page_title} {$separator} {$site_name}" : $page_title; } if (is_home() || is_archive() || is_search()) { #wp $current_page = get_query_var('paged'); #wp if ($current_page > 1) { $output .= " {$separator} " . __('Page', 'thesis') . " {$current_page}"; } } $this->title['title'] = '<title>' . apply_filters('thesis_title', $output, $separator) . '</title>'; #wp #filter }
static function getWordpressData() { /** * Get all global page data */ $blogDataParams = array( 'url', 'wpurl', 'description', 'rdf_url' , 'rss_url', 'rss2_url' , 'atom_url', 'comments_atom_url', 'comments_rss2_url', 'pingback_url' , 'stylesheet_url', 'stylesheet_directory', 'template_directory' , 'template_url', 'admin_email', 'charset', 'html_type', 'version' , 'language', 'text_direction', 'name' ); $blogData = array(); foreach($blogDataParams as $blogDataParam) { $blogData[self::toCamelCase($blogDataParam)] = get_bloginfo($blogDataParam); } $blogData = array_merge($blogData, array( 'title' => wp_title(' | ', false, 'right') . get_bloginfo('name'), 'archiveLinksHTML' => wp_get_archives('type=monthly&limit=5&format=link&echo=0'), 'bodyClasses' => self::getEchoFunctionContents('body_class'), 'posts' => array() )); /** * Get posts data */ while (have_posts()) { the_post(); $postId = get_the_ID(); // Get category data $categories = get_the_category(); $categoryNames = array(); foreach($categories as $category) { array_push($categoryNames, $category->cat_name); } // Add all relevant post data to the posts array array_push( $blogData['posts'], array_merge( get_object_vars(get_post($postId)), array( 'classes' => get_post_class(), 'comments' => get_comments(array('post_id' => $postId)), 'custom' => get_post_custom(), 'permalink' => get_permalink(), 'categories' => $categories, 'categoryNames' => $categoryNames, 'categoriesStr' => implode(',', $categoryNames) ) ) ); } return $blogData; }
function blackoot_render_title() { ?> <title><?php wp_title('|', true, 'right'); ?> </title><?php }
function wptouch_title() { if (is_home()) { echo wptouch_bloginfo('site_title'); } else { echo wptouch_bloginfo('site_title') . wp_title(' » ', 0); } }
function nuts_render_title() { ?> <title><?php wp_title('|', true, 'right'); ?> </title> <?php }
function merge_meta($meta) { if (!isset($meta)) { $meta = array(); } $meta_default = array('title' => trim(wp_title('', false)), 'description' => LOGO, 'image' => SHARE); return array_merge($meta_default, $meta); }
function mh_magazine_render_title() { ?> <title><?php wp_title('|', true, 'right'); ?> </title><?php }
function just_clean_shop_slug_render_title() { ?> <title><?php wp_title('|', true, 'right'); ?> </title><?php }
/** * Meta Title */ function nirvana_meta_title() { global $nirvanas; echo "<title>" . wp_title('', false, 'right') . "</title>"; if ($nirvanas['nirvana_iecompat']) { echo PHP_EOL . '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />'; } }
function getBlogTitle() { if (is_home()) { return get_bloginfo('name'); } else { return wp_title("-", false, "right") . " " . get_bloginfo('name'); } }
function lo_description() { global $s, $post; $description = ''; $blog_name = get_bloginfo('name'); if (is_singular()) { $ID = $post->ID; $title = $post->post_title; $author = $post->post_author; $user_info = get_userdata($author); $post_author = $user_info->display_name; if (!get_post_meta($ID, "meta-description", true)) { $description = $title . ' - 作者: ' . $post_author . ',首发于' . $blog_name; } else { $description = get_post_meta($ID, "meta-description", true); } } elseif (is_home()) { $description = lo_opt('index_description'); } elseif (is_tag()) { $description = single_tag_title('', false) . " - " . trim(strip_tags(tag_description())); } elseif (is_category()) { $description = single_cat_title('', false) . " - " . trim(strip_tags(category_description())); } elseif (is_archive()) { $description = $blog_name . "'" . trim(wp_title('', false)) . "'"; } elseif (is_search()) { $description = $blog_name . ": '" . esc_html($s, 1) . "' 的搜索結果"; } else { $description = $blog_name . "'" . trim(wp_title('', false)) . "'"; } $description = mb_substr($description, 0, 220, 'utf-8'); echo "<meta name=\"description\" content=\"{$description}\">\n"; }
/** * Showing the title in the browser tab. * * @uses wp_title() Display the title on the browser tab. */ function cleanretina_show_title() { ?> <title> <?php if (is_page(5)) { ?> Productos - MULTIEMPAC <?php } else { ?> <?php /** * Print the <title> tag based on what is being viewed. */ wp_title('|', true, 'right'); ?> <?php } ?> </title> <?php }
/** * Custom the wp_title() * * @since 0.0.1 */ function vp_title() { global $page, $paged; $output = ''; if (0 < vp_unread_notifications_count()) { $output .= '(' . vp_unread_notifications_count() . ') '; } $name = get_bloginfo('name'); $description = get_bloginfo('description'); $sep = ' › '; $normal_title = wp_title($sep, false, 'left'); $output .= $name; if ($description && (is_home() || is_front_page())) { $output .= ' - ' . $description; } elseif (is_page('member')) { $output .= $sep . esc_attr(get_query_var('member_name')); } else { $output .= $normal_title; } // Add a page number if necessary if ($paged >= 2 || $page >= 2) { $output .= $sep . __('Page', 'v2press') . max($paged, $page); } echo $output; }