当前位置: 首页>>代码示例>>PHP>>正文


PHP single_month_title函数代码示例

本文整理汇总了PHP中single_month_title函数的典型用法代码示例。如果您正苦于以下问题:PHP single_month_title函数的具体用法?PHP single_month_title怎么用?PHP single_month_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了single_month_title函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: webdados_fb_open_graph


//.........这里部分代码省略.........
                $fb_title = esc_attr(strip_tags(stripslashes(single_tag_title('', false))));
                $term = $wp_query->get_queried_object();
                $fb_url = get_term_link($term, $term->taxonomy);
                $tag_desc = trim(esc_attr(strip_tags(stripslashes(tag_description()))));
                if (trim($tag_desc) != '') {
                    $fb_desc = $tag_desc;
                }
            } else {
                if (is_tax()) {
                    $fb_title = esc_attr(strip_tags(stripslashes(single_term_title('', false))));
                    $term = $wp_query->get_queried_object();
                    $fb_url = get_term_link($term, $term->taxonomy);
                    //WooCommerce
                    if (intval($fb_image_show) == 1 || intval($fb_image_show_schema) == 1 || intval($fb_image_show_twitter) == 1) {
                        if (class_exists('woocommerce') && $fb_wc_usecategthumb == 1 && is_product_category()) {
                            if ($thumbnail_id = get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true)) {
                                if ($image = wp_get_attachment_url($thumbnail_id)) {
                                    $fb_image = $image;
                                }
                            }
                        }
                    }
                } else {
                    if (is_search()) {
                        $fb_title = esc_attr(strip_tags(stripslashes(__('Search for') . ' "' . get_search_query() . '"')));
                        $fb_url = get_search_link();
                    } else {
                        if (is_author()) {
                            $fb_title = esc_attr(strip_tags(stripslashes(get_the_author_meta('display_name', get_query_var('author')))));
                            $fb_url = get_author_posts_url(get_query_var('author'), get_query_var('author_name'));
                        } else {
                            if (is_archive()) {
                                if (is_day()) {
                                    $fb_title = esc_attr(strip_tags(stripslashes(get_query_var('day') . ' ' . single_month_title(' ', false) . ' ' . __('Archives'))));
                                    $fb_url = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day'));
                                } else {
                                    if (is_month()) {
                                        $fb_title = esc_attr(strip_tags(stripslashes(single_month_title(' ', false) . ' ' . __('Archives'))));
                                        $fb_url = get_month_link(get_query_var('year'), get_query_var('monthnum'));
                                    } else {
                                        if (is_year()) {
                                            $fb_title = esc_attr(strip_tags(stripslashes(get_query_var('year') . ' ' . __('Archives'))));
                                            $fb_url = get_year_link(get_query_var('year'));
                                        }
                                    }
                                }
                            } else {
                                if (is_front_page()) {
                                    $fb_url = get_option('home') . (intval($fb_url_add_trailing) == 1 ? '/' : '');
                                    $fb_type = trim($fb_type_homepage == '' ? 'website' : $fb_type_homepage);
                                } else {
                                    //Others... Defaults already set up there
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    //If no description let's just add the title
    if (trim($fb_desc) == '') {
        $fb_desc = $fb_title;
    }
    //YOAST?
    if ($fb_show_wpseoyoast == 1) {
开发者ID:BetterDigitalServices,项目名称:bluearrow,代码行数:67,代码来源:wonderm00n-open-graph.php

示例2: smarty_single_month_title

function smarty_single_month_title($params)
{
    $display = '';
    $prefix = '';
    extract($params);
    return single_month_title($prefix, $display);
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:7,代码来源:class-smarty.php

示例3: 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
 * @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;
}
开发者ID:aleksking,项目名称:sherrill,代码行数:45,代码来源:deprecated.php

示例4: tarski_document_title

/**
 * Creates 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
 *
 * @hook filter tarski_doctitle
 * Filter document titles.
 */
function tarski_document_title($title, $sep, $seplocation)
{
    $title = trim($title);
    $sitename = get_bloginfo('name');
    $enc = get_option('blog_charset');
    if (!(isset($enc) && strlen($enc) > 0)) {
        $enc = "utf-8";
    }
    $slen = mb_strlen($sep, $enc);
    $tlen = mb_strlen($title, $enc);
    if ($seplocation == 'right') {
        $doctitle = mb_substr($title, 0, $tlen - $slen, $enc);
    } else {
        $doctitle = mb_substr($title, $slen, $tlen - $slen, $enc);
    }
    $doctitle = trim($doctitle);
    if (is_404()) {
        $doctitle = sprintf(__('Error %s', 'tarski'), '404');
    } elseif (get_option('show_on_front') == 'posts' && is_home()) {
        $doctitle = get_bloginfo('description', 'display');
    } elseif (is_search()) {
        $doctitle = sprintf(__('Search results for %s', 'tarski'), esc_html(get_search_query()));
    } elseif (is_month()) {
        $doctitle = single_month_title(' ', false);
    } elseif (is_tag()) {
        $doctitle = multiple_tag_titles();
    }
    $title = array($sitename, $sep, $doctitle);
    if (get_tarski_option('swap_title_order')) {
        $title = array_reverse($title);
    }
    return implode(" ", $title);
}
开发者ID:aleksking,项目名称:sherrill,代码行数:49,代码来源:template_helper.php

示例5: getPost

 function getPost()
 {
     $data = new stdClass();
     $categoryId = (int) get_query_var('cat');
     if (is_tag()) {
         $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
         $tagQuery = get_query_var('tag');
         $tagData = get_tags(array('slug' => $tagQuery));
         $data->post->post_title = esc_html($tagData[0]->name);
     } elseif (is_category($categoryId)) {
         $category = get_category($categoryId);
         $data->post = get_post(ThemeOption::getOption('blog_category_post_id'));
         $data->post->post_title = ThemeHelper::esc_html($category->name);
     } elseif (is_day()) {
         $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
         $data->post->post_title = get_the_date();
     } elseif (is_archive()) {
         $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
         $data->post->post_title = single_month_title(' ', false);
     } elseif (is_search()) {
         $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
         $data->post->post_title = sprintf(__('Search result for phrase <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
     } elseif (is_404()) {
         $data->post = get_post(ThemeOption::getOption('page_404_page_id'));
         $data->post->post_title = $data->post->post_title;
     } else {
         return false;
     }
     return $data;
 }
开发者ID:annguyenit,项目名称:HawaiiEducation,代码行数:30,代码来源:Theme.Post.class.php

示例6: tarski_doctitle

/**
 * 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 = '&middot;')
{
    $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;
}
开发者ID:alicam,项目名称:vanilla-theme,代码行数:47,代码来源:template_helper.php

示例7: basey_breadcrumbs

/**
 * Breadcrumbs
 * @return html
 * @source http://yootheme.com (Warp Themes)
 */
function basey_breadcrumbs()
{
    global $wp_query;
    if (!is_home() && !is_front_page()) {
        $output = '<ul class="zz-link-more-muted zz-text-more-muted zz-position-up uk-breadcrumb uk-hidden-small">';
        $output .= '<li><a href="' . get_option('home') . '">Home</a></li>';
        if (is_single()) {
            $cats = get_the_category();
            if ($cats) {
                $cat = $cats[0];
                if (is_object($cat)) {
                    if ($cat->parent != 0) {
                        $cats = explode("@@@", get_category_parents($cat->term_id, true, "@@@"));
                        unset($cats[count($cats) - 1]);
                        $output .= str_replace('<li>@@', '<li>', '<li>' . implode("</li><li>", $cats) . '</li>');
                    } else {
                        $output .= '<li><a href="' . get_category_link($cat->term_id) . '">' . $cat->name . '</a></li>';
                    }
                }
            }
        }
        if (is_category()) {
            $cat_obj = $wp_query->get_queried_object();
            $cats = explode("@@@", get_category_parents($cat_obj->term_id, TRUE, '@@@'));
            unset($cats[count($cats) - 1]);
            $cats[count($cats) - 1] = '@@<span>' . strip_tags($cats[count($cats) - 1]) . '</span>';
            $output .= str_replace('<li>@@', '<li class="uk-active">', '<li>' . implode("</li><li>", $cats) . '</li>');
        } elseif (is_tag()) {
            $output .= '<li class="uk-active"><span>' . single_cat_title('', false) . '</span></li>';
        } elseif (is_date()) {
            $output .= '<li class="uk-active"><span>' . single_month_title(' ', false) . '</span></li>';
        } elseif (is_author()) {
            $user = get_user_by('login', get_the_author());
            $output .= '<li class="uk-active"><span>' . $user->display_name . '</span></li>';
        } elseif (is_search()) {
            $output .= '<li class="uk-active"><span>' . stripslashes(strip_tags(get_search_query())) . '</span></li>';
        } elseif (is_tax()) {
            $taxonomy = get_taxonomy(get_query_var('taxonomy'));
            $term = get_query_var('term');
            $output .= '<li class="uk-active"><span>' . $taxonomy->label . ': ' . $term . '</span></li>';
        } else {
            if (!in_array(get_post_type(), array('post', 'page'))) {
                $cpt = get_post_type_object(get_post_type());
                $output .= '<li><a href="' . get_post_type_archive_link(get_post_type()) . '">' . $cpt->labels->name . '</a></li>';
            }
            $ancestors = get_ancestors(get_the_ID(), 'page');
            for ($i = count($ancestors) - 1; $i >= 0; $i--) {
                $output .= '<li><a href="' . get_page_link($ancestors[$i]) . '" title="' . get_the_title($ancestors[$i]) . '">' . get_the_title($ancestors[$i]) . '</a></li>';
            }
            $output .= '<li class="uk-active"><span>' . get_the_title() . '</span></li>';
        }
        $output .= '</ul>';
    } else {
        $output = '<ul class="uk-breadcrumb">';
        $output .= '<li class="uk-active"><span>Home</span></li>';
        $output .= '</ul>';
    }
    echo $output;
}
开发者ID:kokokokokokoko,项目名称:basey-theme,代码行数:64,代码来源:functions.php

示例8: omega_wp_title

/**
 * Filters the `wp_title` output early.
 *
 * @since  0.9.0
 * @access publc
 * @param  string  $title
 * @param  string  $separator
 * @param  string  $seplocation
 * @return string
 */
function omega_wp_title($title, $separator, $seplocation)
{
    if (is_front_page()) {
        $doctitle = get_bloginfo('name') . $separator . ' ' . get_bloginfo('description');
    } elseif (is_home() || is_singular()) {
        $doctitle = single_post_title('', false);
    } elseif (is_category()) {
        $doctitle = single_cat_title('', false);
    } elseif (is_tag()) {
        $doctitle = single_tag_title('', false);
    } elseif (is_tax()) {
        $doctitle = single_term_title('', false);
    } elseif (is_post_type_archive()) {
        $doctitle = post_type_archive_title('', false);
    } elseif (is_author()) {
        $doctitle = get_the_author_meta('display_name', get_query_var('author'));
    } elseif (get_query_var('minute') && get_query_var('hour')) {
        $doctitle = omega_single_minute_hour_title('', false);
    } elseif (get_query_var('minute')) {
        $doctitle = omega_single_minute_title('', false);
    } elseif (get_query_var('hour')) {
        $doctitle = omega_single_hour_title('', false);
    } elseif (is_day()) {
        $doctitle = omega_single_day_title('', false);
    } elseif (get_query_var('w')) {
        $doctitle = omega_single_week_title('', false);
    } elseif (is_month()) {
        $doctitle = single_month_title(' ', false);
    } elseif (is_year()) {
        $doctitle = omega_single_year_title('', false);
    } elseif (is_archive()) {
        $doctitle = omega_single_archive_title('', false);
    } elseif (is_search()) {
        $doctitle = omega_search_title('', false);
    } elseif (is_404()) {
        $doctitle = omega_404_title('', false);
    } else {
        $doctitle = '';
    }
    /* If the current page is a paged page. */
    if ((($page = get_query_var('paged')) || ($page = get_query_var('page'))) && $page > 1) {
        /* Translators: 1 is the page title. 2 is the page number. */
        $doctitle = sprintf(__('%1$s Page %2$s', 'omega'), $doctitle . $separator, number_format_i18n(absint($page)));
    }
    /* Trim separator + space from beginning and end. */
    $doctitle = trim($doctitle, "{$separator} ");
    return $doctitle;
}
开发者ID:javipaur,项目名称:TiendaVirtual,代码行数:58,代码来源:head.php

示例9: getPost

 function getPost()
 {
     $data = new stdClass();
     global $post, $wp_query;
     $categoryId = (int) get_query_var('cat');
     if (function_exists('is_woocommerce') && is_woocommerce()) {
         $data->post = get_post(get_option('woocommerce_shop_page_id'));
         if (is_product()) {
             $data->post = $post;
         } elseif (is_product_category() || is_product_tag()) {
             $data->post->post_title = ThemeHelper::esc_html($wp_query->queried_object->name);
         } elseif (is_search()) {
             $data->post->post_title = sprintf(__('Search products for phrase <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
         }
         setup_postdata($data->post);
     } else {
         if (is_tag()) {
             $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
             $tagQuery = get_query_var('tag');
             $tagData = get_tags(array('slug' => $tagQuery));
             $data->post->post_title = esc_html($tagData[0]->name);
         } elseif (is_author()) {
             $author = get_userdata(get_query_var('author'));
             $data->post = get_post(ThemeOption::getOption('blog_author_post_id'));
             $data->post->post_title = sprintf(__('All posts from %s', THEME_DOMAIN), get_the_author_meta('display_name', $author->data->ID));
         } elseif (is_category($categoryId)) {
             $category = get_category($categoryId);
             $data->post = get_post(ThemeOption::getOption('blog_category_post_id'));
             $data->post->post_title = ThemeHelper::esc_html($category->name);
         } elseif (is_day()) {
             $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
             $data->post->post_title = get_the_date();
         } elseif (is_archive()) {
             $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
             $data->post->post_title = single_month_title(' ', false);
         } elseif (is_search()) {
             $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
             $data->post->post_title = sprintf(__('Kết quả tìm kiếm: <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
         } elseif (is_404()) {
             $data->post = get_post(ThemeOption::getOption('page_404_page_id'));
             $data->post->post_title = $data->post->post_title;
         } else {
             return false;
         }
     }
     return $data;
 }
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:47,代码来源:Theme.Post.class.php

示例10: munsa_lite_archive_title_filter

/**
 * Filters `get_the_archve_title` to add better archive titles than core.
 *
 * @since  1.0.0
 *
 * @param  string  $title
 * @return string
 */
function munsa_lite_archive_title_filter($title)
{
    if (is_home() && !is_front_page()) {
        $title = get_post_field('post_title', get_queried_object_id());
    } elseif (is_category()) {
        $title = single_cat_title('', false);
    } elseif (is_tag()) {
        $title = single_tag_title('', false);
    } elseif (is_tax()) {
        $title = single_term_title('', false);
    } elseif (is_author()) {
        $title = get_the_author_meta('display_name', absint(get_query_var('author')));
    } elseif (is_search()) {
        $title = sprintf(esc_html__('Search results for &#8220;%s&#8221;', 'munsa-lite'), get_search_query());
    } elseif (is_post_type_archive()) {
        $title = post_type_archive_title('', false);
    } elseif (is_month()) {
        $title = single_month_title(' ', false);
    }
    return apply_filters('munsa_lite_archive_title', $title);
}
开发者ID:samikeijonen,项目名称:munsa-lite,代码行数:29,代码来源:archive-filters.php

示例11: add_month_crumb

 /**
  * Add (non-link) month crumb to crumbs property
  */
 private function add_month_crumb()
 {
     $this->add_predefined_crumb($this->options['breadcrumbs-archiveprefix'] . ' ' . esc_html(single_month_title(' ', false)), null, true);
 }
开发者ID:johnreytepacia,项目名称:etarticles,代码行数:7,代码来源:class-breadcrumbs.php

示例12: single_cat_title

		<div class="large-12 columns">
	
			
<h1><?php 
    if (is_category()) {
        single_cat_title();
    } elseif (is_tag()) {
        echo __('Archives for ', 'consultant');
        single_tag_title();
    } elseif (is_author()) {
        $curauth = isset($_GET['author_name']) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
        echo __('Archives for ', 'consultant');
        echo $curauth->nickname;
    } elseif (is_archive()) {
        echo __('Archives for ', 'consultant');
        single_month_title(' ', true);
    } else {
        wp_title('', true);
    }
    ?>
</h1>
			
			</div>	
			
	</div></div>
	
<?php 
}
?>

<?php 
开发者ID:naudart,项目名称:CnConsultants,代码行数:31,代码来源:home.php

示例13: bf_add_breadcrumbs

/**
 * {@internal Missing Short Description }}
 * 
 * {@internal Missing Long Description }}
 * 
 * @hook	filter	bf_breadcrumb_prefix
 * @since	0.5.2
 */
function bf_add_breadcrumbs()
{
    /*
     * Taken from Yoast Breadcrumb (http://yoast.com/wordpress/breadcrumbs/).
     * Edited it to display the breadcrumb in a unordered list for certain jQuery plugins to work.
     */
    global $wp_query;
    $output = '';
    $on_front = get_option('show_on_front');
    $output .= '<ul class="breadcrumbs clearfix" id="breadcrumbs">';
    // comment this to hide prefix notice
    //$prefix = apply_filters( 'bf_breadcrumb_prefix', __('You are Here:', 'buffet') );
    if ($prefix != '') {
        $output .= '<li class="notice">' . $prefix . '</li>';
    }
    function bf_get_category_parents($id, $link = false, $separator = '', $nicename = false)
    {
        $chain = '';
        $parent =& get_category($id);
        if (is_wp_error($parent)) {
            return $parent;
        }
        if ($nicename) {
            $name = $parent->slug;
        } else {
            $name = $parent->cat_name;
        }
        if ($parent->parent && $parent->parent != $parent->term_id) {
            $chain .= '<li>' . get_category_parents($parent->parent, true, $separator, $nicename) . '</li>';
        }
        if (is_single()) {
            return $chain . '<li><a href="' . get_category_link($id) . '">' . $name . '</a></li>';
        } else {
            return $chain . '<li><strong>' . $name . '</strong></li>';
        }
    }
    if ($on_front == "page") {
        $homelink = '<li><a href="' . get_permalink(get_option('page_on_front')) . '">' . bf_get_option('home_link') . '</a></li>';
        $bloglink = $homelink . '<li><a href="' . get_permalink(get_option('page_for_posts')) . '">' . bf_get_option('blog_link') . '</a></li>';
    } else {
        $homelink = '<li><a href="' . get_bloginfo('url') . '">' . bf_get_option('home_link') . '</a></li>';
        $bloglink = $homelink;
    }
    if ($on_front == "page" && is_front_page() || $on_front == "posts" && is_home()) {
        $output .= '<li><strong>' . bf_get_option('home_link') . '</strong></li>';
    } elseif ($on_front == "page" && is_home()) {
        $output .= $homelink . '<li><strong>' . bf_get_option('blog_link') . '</strong></li>';
    } elseif (!is_page()) {
        $output .= $homelink;
        if ((is_single() || is_category() || is_tag() || is_date() || is_author()) && bf_get_option('single_parent') != false) {
            $output .= '<li><a href="' . get_permalink(bf_get_option('single_parent')) . '">' . get_the_title(bf_get_option('single_parent')) . '</a></li>';
        }
        if (is_single()) {
            $cats = get_the_category();
            $cat = $cats[0];
            if ($cat->parent != 0) {
                $output .= bf_get_category_parents($cat->term_id, true, "");
            } else {
                $output .= '<li><a href="' . get_category_link($cat->term_id) . '">' . $cat->name . '</a></li>';
            }
        }
        if (is_category()) {
            $cat = intval(get_query_var('cat'));
            $output .= bf_get_category_parents($cat, false, "");
        } elseif (is_tag()) {
            $output .= '<li><strong>' . single_cat_title(' ', false) . '</strong></li>';
        } elseif (is_date()) {
            $output .= '<li><strong>' . single_month_title(' ', false) . '</strong></li>';
        } elseif (is_author()) {
            $user = get_userdatabylogin($wp_query->query_vars['author_name']);
            $output .= '<li><strong>' . $user->display_name . '</strong></li>';
        } elseif (is_search()) {
            $output .= '<li><strong>' . get_search_query() . '</strong></li>';
        } else {
            $output .= '<li><strong>' . get_the_title() . '</strong></li>';
        }
    } else {
        $post = $wp_query->get_queried_object();
        // If this is a top level Page, it's simple to output the breadcrumb
        if (0 == $post->post_parent) {
            $output .= $homelink . '<li><strong>' . get_the_title() . '</strong></li>';
        } else {
            if (isset($post->ancestors)) {
                if (is_array($post->ancestors)) {
                    $ancestors = array_values($post->ancestors);
                } else {
                    $ancestors = array($post->ancestors);
                }
            } else {
                $ancestors = array($post->post_parent);
            }
            // Reverse the order so it's oldest to newest
//.........这里部分代码省略.........
开发者ID:jagtesh,项目名称:op_theme,代码行数:101,代码来源:template.php

示例14: title


//.........这里部分代码省略.........
                     $title = get_bloginfo('name');
                 }
             }
         } else {
             if (is_singular()) {
                 $fixed_title = wpseo_get_value('title');
                 if ($fixed_title) {
                     $title = $fixed_title;
                 } else {
                     if (isset($options['title-' . $post->post_type]) && !empty($options['title-' . $post->post_type])) {
                         $title = wpseo_replace_vars($options['title-' . $post->post_type], (array) $post);
                     } else {
                         $title = get_the_title();
                         $title = apply_filters('single_post_title', $title);
                     }
                 }
             } else {
                 if (is_category() || is_tag() || is_tax()) {
                     $term = $wp_query->get_queried_object();
                     $title = trim(wpseo_get_term_meta($term, $term->taxonomy, 'title'));
                     if (!$title || empty($title)) {
                         if (isset($options['title-' . $term->taxonomy]) && !empty($options['title-' . $term->taxonomy])) {
                             $title = wpseo_replace_vars($options['title-' . $term->taxonomy], (array) $term);
                         } else {
                             if (is_category()) {
                                 $title = single_cat_title('', false);
                             } else {
                                 if (is_tag()) {
                                     $title = single_tag_title('', false);
                                 } else {
                                     if (is_tax()) {
                                         if (function_exists('single_term_title')) {
                                             $title = single_term_title('', false);
                                         } else {
                                             $term = $wp_query->get_queried_object();
                                             $title = $term->name;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 } else {
                     if (is_search()) {
                         if (isset($options['title-search']) && !empty($options['title-search'])) {
                             $title = wpseo_replace_vars($options['title-search'], (array) $wp_query->get_queried_object());
                         } else {
                             $title = __('Search for "') . get_search_query() . '"';
                         }
                     } else {
                         if (is_author()) {
                             $author_id = get_query_var('author');
                             $title = get_the_author_meta('wpseo_title', $author_id);
                             if (empty($title)) {
                                 if (isset($options['title-author']) && !empty($options['title-author'])) {
                                     $title = wpseo_replace_vars($options['title-author'], array());
                                 } else {
                                     $title = get_the_author_meta('display_name', $author_id);
                                 }
                             }
                         } else {
                             if (is_post_type_archive()) {
                                 $post_type = get_post_type();
                                 if (isset($options['title-ptarchive-' . $post_type]) && '' != $options['title-ptarchive-' . $post_type]) {
                                     return $options['title-ptarchive-' . $post_type];
                                 } else {
                                     $post_type_obj = get_post_type_object($post_type);
                                     $title = $post_type_obj->labels->menu_name;
                                 }
                             } else {
                                 if (is_archive()) {
                                     if (isset($options['title-archive']) && !empty($options['title-archive'])) {
                                         $title = wpseo_replace_vars($options['title-archive'], array('post_title' => $title));
                                     } else {
                                         if (is_month()) {
                                             $title = single_month_title(' ', false) . ' ' . __('Archives');
                                         } else {
                                             if (is_year()) {
                                                 $title = get_query_var('year') . ' ' . __('Archives');
                                             }
                                         }
                                     }
                                 } else {
                                     if (is_404()) {
                                         if (isset($options['title-404']) && !empty($options['title-404'])) {
                                             $title = wpseo_replace_vars($options['title-404'], array('post_title' => $title));
                                         } else {
                                             $title = __('Page not found');
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     echo "<meta property='og:title' content='" . esc_attr(strip_tags(stripslashes($title))) . "'/>\n";
 }
开发者ID:Joshuwar,项目名称:Masterson,代码行数:101,代码来源:class-opengraph.php

示例15: wpseo_replace_vars

/**
 * @param string $string the string to replace the variables in.
 * @param array  $args   the object some of the replacement values might come from, could be a post, taxonomy or term.
 * @param array  $omit   variables that should not be replaced by this function.
 * @return string
 */
function wpseo_replace_vars($string, $args, $omit = array())
{
    $args = (array) $args;
    $string = strip_tags($string);
    // Let's see if we can bail super early.
    if (strpos($string, '%%') === false) {
        return trim(preg_replace('/\\s+/u', ' ', $string));
    }
    global $sep;
    if (!isset($sep) || empty($sep)) {
        $sep = '-';
    }
    $simple_replacements = array('%%sep%%' => $sep, '%%sitename%%' => get_bloginfo('name'), '%%sitedesc%%' => get_bloginfo('description'), '%%currenttime%%' => date('H:i'), '%%currentdate%%' => date('M jS Y'), '%%currentmonth%%' => date('F'), '%%currentyear%%' => date('Y'));
    foreach ($simple_replacements as $var => $repl) {
        $string = str_replace($var, $repl, $string);
    }
    // Let's see if we can bail early.
    if (strpos($string, '%%') === false) {
        return trim(preg_replace('/\\s+/u', ' ', $string));
    }
    global $wp_query;
    $defaults = array('ID' => '', 'name' => '', 'post_author' => '', 'post_content' => '', 'post_date' => '', 'post_excerpt' => '', 'post_modified' => '', 'post_title' => '', 'taxonomy' => '', 'term_id' => '');
    if (isset($args['post_content'])) {
        $args['post_content'] = wpseo_strip_shortcode($args['post_content']);
    }
    if (isset($args['post_excerpt'])) {
        $args['post_excerpt'] = wpseo_strip_shortcode($args['post_excerpt']);
    }
    $r = (object) wp_parse_args($args, $defaults);
    $max_num_pages = 1;
    if (!is_single()) {
        $pagenum = get_query_var('paged');
        if ($pagenum === 0) {
            $pagenum = 1;
        }
        if (isset($wp_query->max_num_pages) && $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0) {
            $max_num_pages = $wp_query->max_num_pages;
        }
    } else {
        global $post;
        $pagenum = get_query_var('page');
        $max_num_pages = isset($post->post_content) ? substr_count($post->post_content, '<!--nextpage-->') : 1;
        if ($max_num_pages >= 1) {
            $max_num_pages++;
        }
    }
    // Let's do date first as it's a bit more work to get right.
    if ($r->post_date != '') {
        $date = mysql2date(get_option('date_format'), $r->post_date);
    } else {
        if (get_query_var('day') && get_query_var('day') != '') {
            $date = get_the_date();
        } else {
            if (single_month_title(' ', false) && single_month_title(' ', false) != '') {
                $date = single_month_title(' ', false);
            } else {
                if (get_query_var('year') != '') {
                    $date = get_query_var('year');
                } else {
                    $date = '';
                }
            }
        }
    }
    $replacements = array('%%date%%' => $date, '%%searchphrase%%' => esc_html(get_query_var('s')), '%%page%%' => $max_num_pages > 1 && $pagenum > 1 ? sprintf($sep . ' ' . __('Page %d of %d', 'wordpress-seo'), $pagenum, $max_num_pages) : '', '%%pagetotal%%' => $max_num_pages, '%%pagenumber%%' => $pagenum);
    if (isset($r->ID)) {
        $replacements = array_merge($replacements, array('%%caption%%' => $r->post_excerpt, '%%category%%' => wpseo_get_terms($r->ID, 'category'), '%%excerpt%%' => !empty($r->post_excerpt) ? strip_tags($r->post_excerpt) : utf8_encode(substr(strip_shortcodes(strip_tags(utf8_decode($r->post_content))), 0, 155)), '%%excerpt_only%%' => strip_tags($r->post_excerpt), '%%focuskw%%' => wpseo_get_value('focuskw', $r->ID), '%%id%%' => $r->ID, '%%modified%%' => mysql2date(get_option('date_format'), $r->post_modified), '%%name%%' => get_the_author_meta('display_name', !empty($r->post_author) ? $r->post_author : get_query_var('author')), '%%tag%%' => wpseo_get_terms($r->ID, 'post_tag'), '%%title%%' => stripslashes($r->post_title), '%%userid%%' => !empty($r->post_author) ? $r->post_author : get_query_var('author')));
    }
    if (!empty($r->taxonomy)) {
        $replacements = array_merge($replacements, array('%%category_description%%' => trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))), '%%tag_description%%' => trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))), '%%term_description%%' => trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))), '%%term_title%%' => $r->name));
    }
    foreach ($replacements as $var => $repl) {
        if (!in_array($var, $omit)) {
            $string = str_replace($var, $repl, $string);
        }
    }
    if (strpos($string, '%%') === false) {
        $string = preg_replace('/\\s+/u', ' ', $string);
        return trim($string);
    }
    if (isset($wp_query->query_vars['post_type']) && preg_match_all('/%%pt_([^%]+)%%/u', $string, $matches, PREG_SET_ORDER)) {
        $pt = get_post_type_object($wp_query->query_vars['post_type']);
        $pt_plural = $pt_singular = $pt->name;
        if (isset($pt->labels->singular_name)) {
            $pt_singular = $pt->labels->singular_name;
        }
        if (isset($pt->labels->name)) {
            $pt_plural = $pt->labels->name;
        }
        $string = str_replace('%%pt_single%%', $pt_singular, $string);
        $string = str_replace('%%pt_plural%%', $pt_plural, $string);
    }
    if (preg_match_all('/%%cf_([^%]+)%%/u', $string, $matches, PREG_SET_ORDER)) {
        global $post;
//.........这里部分代码省略.........
开发者ID:juslee,项目名称:e27,代码行数:101,代码来源:wpseo-functions.php


注:本文中的single_month_title函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。