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


PHP single_post_title函数代码示例

本文整理汇总了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>&nbsp;&nbsp;>&nbsp;&nbsp;</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>&nbsp;&nbsp;>&nbsp;&nbsp;</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>&nbsp;&nbsp;>&nbsp;&nbsp;</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>';
    }
}
开发者ID:breakthroughdesign,项目名称:qaulitrol,代码行数:26,代码来源:functions.php

示例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 &ldquo;%s&rdquo;', '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);
}
开发者ID:synapticism,项目名称:ubik-title,代码行数:25,代码来源:ubik-title-core.php

示例3: get_value

 public function get_value()
 {
     if (is_singular() && post_type_supports(get_post_type(), 'title')) {
         return single_post_title('', false);
     }
     return false;
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:7,代码来源:default-formatting-tags.php

示例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;
    }
}
开发者ID:pixelartdev,项目名称:Pixelart-Verifier,代码行数:25,代码来源:px-support.php

示例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;
}
开发者ID:Bakerpedia,项目名称:Development_Site5,代码行数:37,代码来源:functions.php

示例6: smarty_single_post_title

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

示例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();
            }
        }
    }
}
开发者ID:Plou,项目名称:TD-Wordpress,代码行数:25,代码来源:functions.php

示例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();
    }
}
开发者ID:doio,项目名称:jianux_core,代码行数:33,代码来源:functions.php

示例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(); }
}
开发者ID:nebirhos,项目名称:cargopress,代码行数:8,代码来源:functions.php

示例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;
     }
 }
开发者ID:pierredewit,项目名称:WordPress-Sphinx-Search-plugin,代码行数:59,代码来源:top-searches.php

示例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');
    }
}
开发者ID:patrickod,项目名称:City-Blogger,代码行数:10,代码来源:header.php

示例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;
     }
 }
开发者ID:rotoballer,项目名称:emily,代码行数:11,代码来源:front.php

示例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' />";
    }
}
开发者ID:jrbranaa,项目名称:pitchperspectives,代码行数:12,代码来源:library.php

示例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) . "&amp;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)+'&amp;title='+encodeURIComponent(title),'post','location=no,links=no,scrollbars=no,toolbar=no,width=620,height=400')})()\">" . $button_box . '</a></div>';
     }
     return $button;
 }
开发者ID:royalterra,项目名称:share-on-diaspora,代码行数:53,代码来源:class.php

示例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;
 }
开发者ID:sams,项目名称:Thematic-html5boilerplate,代码行数:50,代码来源:header-extensions.php


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