本文整理汇总了PHP中single_post_title函数的典型用法代码示例。如果您正苦于以下问题:PHP single_post_title函数的具体用法?PHP single_post_title怎么用?PHP single_post_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了single_post_title函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_breadcrumbs
function get_breadcrumbs($post)
{
echo "<li itemscope itemtype=\"http://data-vocabulary.org/Breadcrumb\"><a href=" . get_bloginfo('url') . " itemprop=\"url\"><span itemprop=\"title\">Home</span></a><span class=arrow> > </span></li>";
if (is_home()) {
$breadcrumbs[] = '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="' . get_permalink($page->ID) . '" title="" itemprop="url"><span itemprop="title">' . single_post_title($page->ID) . '</span></a><span class=arrow> > </span></li>';
} elseif (is_single() || is_page()) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="' . get_permalink($page->ID) . '" title="" itemprop="url"><span itemprop="title">' . get_the_title($page->ID) . '</span></a><span class=arrow> > </span></li>';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
foreach ($breadcrumbs as $crumb) {
echo $crumb;
}
echo "<li itemscope itemtype=\"http://data-vocabulary.org/Breadcrumb\"><span itemprop=\"title\">" . $post->post_title . "</span></li>";
} elseif (is_category()) {
echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="' . get_permalink($page->ID) . '" title="" itemprop="url"><span itemprop="title">' . single_cat_title($page->ID) . '</span></a></li>';
} elseif (is_archive()) {
echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">Archives</span></li>';
} elseif (is_404()) {
echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">404 Page Not Found</span></li>';
}
}
示例2: ubik_title
function ubik_title()
{
if (is_home()) {
if (get_option('page_for_posts', true)) {
$title = get_the_title(get_option('page_for_posts', true));
} else {
$title = __('Latest posts', 'ubik');
}
} elseif (is_archive()) {
$title = ubik_title_archives();
} elseif (is_search()) {
if (trim(get_search_query()) === '') {
$title = __('No search query entered', 'ubik');
} else {
$title = sprintf(__('Search results for “%s”', 'ubik'), '<mark>' . trim(get_search_query()) . '</mark>');
}
} elseif (is_404()) {
$title = __('Page not found', 'ubik');
} elseif (is_singular()) {
$title = single_post_title('', false);
} else {
$title = get_the_title();
}
return apply_filters('ubik_title', $title);
}
示例3: get_value
public function get_value()
{
if (is_singular() && post_type_supports(get_post_type(), 'title')) {
return single_post_title('', false);
}
return false;
}
示例4: px_verified_check_user_topic
function px_verified_check_user_topic($have_posts)
{
if (is_user_logged_in()) {
global $wp_roles;
$current_user = wp_get_current_user();
$roles = $current_user->roles;
$role = array_shift($roles);
$forum_name = single_post_title('', false);
if ($role == 'bbp_keymaster' || $role == 'bbp_moderator' || $role == 'administrator' || $role == 'editor') {
} else {
if ($role == 'px_wpba_customer' && $forum_name == 'WordPress Blog Android App' || $forum_name == 'WP Google Cloud Messaging' || $forum_name == 'Special Threads from us') {
} else {
if ($role == 'px_wpgcm_customer' && $forum_name == 'WP Google Cloud Messaging' || $forum_name == 'Special Threads from us') {
} else {
echo '<div class="bbp-template-notice"><p>Sorry, but you do not have the capability to view this forum</p></div>';
return $have_posts = null;
}
}
}
return $have_posts;
} else {
echo '<div class="bbp-template-notice"><p>Sorry, but you do not have the capability to view this topic</p></div>';
return $have_posts = null;
}
}
示例5: mla_wp_title_filter
/**
* Customize the <title> tag content for the Tag Gallery and Single Image pages
*
* @param string The default page title
* @param string $sep How to separate the various items within the page title
* @param string $seplocation Optional. Direction to display title, 'right'.
*
* @return string updated title value
*/
function mla_wp_title_filter($title, $sep, $seplocation)
{
$sep = " {$sep} ";
if (is_page()) {
$page = single_post_title('', false);
/*
* Match specific page titles and replace the default, page title,
* with more interesting term or file information.
*/
if ('Tag Gallery' == $page) {
$taxonomy = isset($_REQUEST['my_taxonomy']) ? $_REQUEST['my_taxonomy'] : NULL;
$slug = isset($_REQUEST['my_term']) ? $_REQUEST['my_term'] : NULL;
if ($taxonomy && $slug) {
$term = get_term_by('slug', $slug, $taxonomy);
return $term->name . $sep;
}
} elseif ('Single Image' == $page) {
$post_id = isset($_REQUEST['post_id']) ? $_REQUEST['post_id'] : 0;
if ($post_id) {
$file = get_attached_file($post_id);
$pathinfo = pathinfo($file);
return $pathinfo['basename'] . $sep;
}
}
}
// is_page
return $title;
}
示例6: smarty_single_post_title
function smarty_single_post_title($params)
{
$display = '';
$prefix = '';
extract($params);
return single_post_title($prefix, $display);
}
示例7: get_title
function get_title()
{
// Récupère la catégorie / étiquette
if (is_tag()) {
$term_id = get_query_var('tag_id');
$taxonomy = 'post_tag';
$args = 'include=' . $term_id;
$term = get_terms($taxonomy, $args);
echo $term[0]->name;
} else {
if (is_category()) {
$cat_id = get_query_var('cat');
$taxonomy = 'category';
$args = 'include=' . $cat_id;
$term = get_terms($taxonomy, $args);
echo $term[0]->name;
} else {
if (is_home()) {
single_post_title();
} else {
the_title();
}
}
}
}
示例8: meta_title
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();
}
}
示例9: cargopress_title
function cargopress_title() {
if ( is_single() ) { single_post_title(); }
elseif ( is_home() || is_front_page() ) { bloginfo('name'); print ' | '; bloginfo('description'); get_page_number(); }
elseif ( is_page() ) { single_post_title(''); }
elseif ( is_search() ) { bloginfo('name'); print ' | Search results for ' . wp_specialchars($s); get_page_number(); }
elseif ( is_404() ) { bloginfo('name'); print ' | Not Found'; }
else { bloginfo('name'); wp_title('|'); get_page_number(); }
}
示例10: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
$this->instance = $instance;
extract($args);
$title_rel = apply_filters('widget_title', $instance['title_rel']);
$title_top = apply_filters('widget_title', $instance['title_top']);
$width = !empty($instance['width']) ? $instance['width'] : 0;
$break = !empty($instance['break']) ? $instance['break'] : '...';
$custom_terms_top = !empty($instance['custom_terms_top']) ? $instance['custom_terms_top'] : '';
$front_show = !empty($instance['front_show']) ? $instance['front_show'] : 'show';
$posts_show = !empty($instance['front_show']) ? $instance['posts_show'] : 'show_related';
$search_show = !empty($instance['front_show']) ? $instance['search_show'] : 'show_related';
$show_approved = !empty($instance['show_approved']) ? $instance['show_approved'] : false;
$period_limit = !empty($instance['period_limit']) ? intval($instance['period_limit']) : '';
$show_widget = false;
//if it is post
if (is_search() && $search_show != 'hide') {
$limit = !empty($instance['search_limit']) ? $instance['search_limit'] : 10;
if ($search_show == 'show_related') {
$title = $title_rel;
$words_html = $this->get_related(get_search_query(), $limit, $width, $break, $show_approved);
}
if (empty($words_html) || $search_show == 'show_top') {
$title = $title_top;
$words_html = $this->get_top($limit, $width, $break, $custom_terms_top, $show_approved, $period_limit);
}
$show_widget = true;
} else {
if (is_singular() && $posts_show != 'hide') {
$limit = !empty($instance['posts_limit']) ? $instance['posts_limit'] : 10;
if ($posts_show == 'show_related') {
$title = $title_rel;
$keywords = single_post_title('', false);
$words_html = $this->get_related($keywords, $limit, $width, $break, $show_approved);
}
if (empty($words_html) || $posts_show == 'show_top') {
$title = $title_top;
$words_html = $this->get_top($limit, $width, $break, $custom_terms_top, $show_approved, $period_limit);
}
$show_widget = true;
} else {
if ($front_show != 'hide') {
$title = $title_top;
$limit = !empty($instance['front_limit']) ? $instance['front_limit'] : 10;
$words_html = $this->get_top($limit, $width, $break, $custom_terms_top, $show_approved, $period_limit);
$show_widget = true;
}
}
}
if ($show_widget) {
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
echo $words_html;
echo $after_widget;
}
}
示例11: meta_desc
function meta_desc()
{
global $post;
if (is_single()) {
$strings = preg_split('/(\\.|!|\\?)\\s/', strip_tags($post->post_content), 2, PREG_SPLIT_DELIM_CAPTURE);
return single_post_title('', true) . ". " . $strings[0] . $strings[1] . " [...]";
} else {
return get_option('metadesc');
}
}
示例12: scan_title
function scan_title($title)
{
global $post;
if (trim($title) == trim(single_post_title('', false))) {
$post->comment_status = "close";
$post->post_password = "";
return $this->controller->title;
} else {
return $title;
}
}
示例13: brickyard_open_graph
function brickyard_open_graph()
{
if (is_single() || is_page()) {
global $wp_query;
$brickyard_postid = $wp_query->post->ID;
$brickyard_title = single_post_title('', false);
$brickyard_title_esc = esc_attr($brickyard_title);
$brickyard_url = get_permalink($brickyard_postid);
$brickyard_blogname = get_bloginfo('name');
echo "\n<meta property='og:title' content='{$brickyard_title_esc}' />", "\n<meta property='og:site_name' content='{$brickyard_blogname}' />", "\n<meta property='og:url' content='{$brickyard_url}' />", "\n<meta property='og:type' content='article' />";
}
}
示例14: generate_button
function generate_button($preview, $use_own_image, $is_feed)
{
/**
* if preview == TRUE && $use_own_image == '0', prepare fake link and output standard button
* if preview == FALSE && $use_own_image == '0', prepare real link and output standard button
* if preview == FALSE && $use_own_image == '1', prepare real link and output custom button
* if preview == TRUE && $use_own_image == '1', impossible
* the button is inside, so let's prepare button first
*/
$button_defaults = $this->button_defaults;
$options_array = get_option('share-on-diaspora-settings');
if ($use_own_image) {
//use own image
$button_box = "<span id='diaspora-button-ownimage-div'><img id='diaspora-button-ownimage-img' src='" . $options_array['image_file'] . "' alt=''/></span>";
} else {
//use standard image
switch ($options_array['button_size']) {
case '2':
$bs = '28';
break;
case '3':
$bs = '33';
break;
case '4':
$bs = '48';
break;
default:
$bs = '23';
}
$bt = !empty($options_array['button_text']) ? $options_array['button_text'] : $button_defaults['button_text'];
$button_box = "<span id='diaspora-button-box'><font>" . $bt . "</font> <span id='diaspora-button-inner'><img src='" . SHARE_ON_DIASPORA_PLUGIN_URL . 'images/asterisk-' . ($bs - 3) . ".png' alt=''/></span></span>";
}
if ($preview || is_admin()) {
//add fake link
$url = "[" . __('Page address here', 'share-on-diaspora') . "]";
$title = "[" . __('Page title here', 'share-on-diaspora') . "]";
} elseif (is_single()) {
//add real link from DOM
$url = esc_url(get_permalink());
$title = single_post_title('', false);
} else {
//add real link from WP
$url = esc_url(get_permalink());
$title = get_the_title();
}
// javascript not allowed in rss feed files
if ($is_feed) {
$button = "<a href='" . SHARE_ON_DIASPORA_PLUGIN_URL . "new_window.php?url=" . rawurlencode($url) . "&title=" . rawurlencode($title) . "' target='_blank'>" . $button_box . "</a>";
} else {
$button = "<div title='Diaspora*' id='diaspora-button-container'><a href=\"javascript:(function(){var url = '" . $url . "' ;var title = '" . $title . "'; window.open('" . SHARE_ON_DIASPORA_PLUGIN_URL . "new_window.php?url='+encodeURIComponent(url)+'&title='+encodeURIComponent(title),'post','location=no,links=no,scrollbars=no,toolbar=no,width=620,height=400')})()\">" . $button_box . '</a></div>';
}
return $button;
}
示例15: thematic_doctitle
function thematic_doctitle()
{
$site_name = get_bloginfo('name');
$separator = '|';
if (is_single()) {
$content = single_post_title('', FALSE);
} elseif (is_home() || is_front_page()) {
$content = get_bloginfo('description');
} elseif (is_page()) {
$content = single_post_title('', FALSE);
} elseif (is_search()) {
$content = __('Search Results for:', 'thematic');
$content .= ' ' . esc_html(stripslashes(get_search_query()));
} elseif (is_category()) {
$content = __('Category Archives:', 'thematic');
$content .= ' ' . single_cat_title("", false);
} elseif (is_tag()) {
$content = __('Tag Archives:', 'thematic');
$content .= ' ' . thematic_tag_query();
} elseif (is_404()) {
$content = __('Not Found', 'thematic');
} else {
$content = get_bloginfo('description');
}
if (get_query_var('paged')) {
$content .= ' ' . $separator . ' ';
$content .= 'Page';
$content .= ' ';
$content .= get_query_var('paged');
}
if ($content) {
if (is_home() || is_front_page()) {
$elements = array('site_name' => $site_name, 'separator' => $separator, 'content' => $content);
} else {
$elements = array('content' => $content);
}
} else {
$elements = array('site_name' => $site_name);
}
// Filters should return an array
$elements = apply_filters('thematic_doctitle', $elements);
// But if they don't, it won't try to implode
if (is_array($elements)) {
$doctitle = implode(' ', $elements);
} else {
$doctitle = $elements;
}
$doctitle = "\t" . "<title>" . $doctitle . "</title>" . "\n\n";
echo $doctitle;
}