當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SucomUtil::is_category_page方法代碼示例

本文整理匯總了PHP中SucomUtil::is_category_page方法的典型用法代碼示例。如果您正苦於以下問題:PHP SucomUtil::is_category_page方法的具體用法?PHP SucomUtil::is_category_page怎麽用?PHP SucomUtil::is_category_page使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SucomUtil的用法示例。


在下文中一共展示了SucomUtil::is_category_page方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_title

 public function get_title($textlen = 70, $trailing = '', $use_post = false, $use_cache = true, $add_hashtags = false, $encode = true, $md_idx = 'og_title', $src_id = '')
 {
     if ($this->p->debug->enabled) {
         $this->p->debug->args(array('textlen' => $textlen, 'trailing' => $trailing, 'use_post' => $use_post, 'use_cache' => $use_cache, 'add_hashtags' => $add_hashtags, 'encode' => $encode, 'md_idx' => $md_idx, 'src_id' => $src_id));
     }
     $title = false;
     $hashtags = '';
     $post_id = 0;
     $paged_suffix = '';
     $separator = html_entity_decode($this->p->options['og_title_sep'], ENT_QUOTES, get_bloginfo('charset'));
     // setup filters to save and restore original / pre-filtered title value
     if (empty($this->p->options['plugin_filter_title'])) {
         add_filter('wp_title', array(&$this, 'wp_title_save'), -9000, 3);
         add_filter('wp_title', array(&$this, 'wp_title_restore'), 9000, 3);
     }
     if (is_singular() || $use_post !== false) {
         if (($obj = $this->p->util->get_post_object($use_post)) === false) {
             if ($this->p->debug->enabled) {
                 $this->p->debug->log('exiting early: invalid object type');
             }
             return $title;
         }
         $post_id = empty($obj->ID) || empty($obj->post_type) ? 0 : $obj->ID;
     }
     // skip if no metadata index / key name
     if (!empty($md_idx)) {
         if (is_singular() || $use_post !== false) {
             if (!empty($post_id)) {
                 $title = $this->p->util->get_mod_options('post', $post_id, array($md_idx, 'og_title'));
             }
         } elseif (SucomUtil::is_term_page()) {
             $term = $this->p->util->get_term_object();
             if (!empty($term->term_id)) {
                 $title = $this->p->util->get_mod_options('taxonomy', $term->term_id, $md_idx);
             }
         } elseif (SucomUtil::is_author_page()) {
             $author = $this->p->util->get_author_object();
             if (!empty($author->ID)) {
                 $title = $this->p->util->get_mod_options('user', $author->ID, $md_idx);
             }
         }
     }
     // get seed if no custom meta title
     if (empty($title)) {
         $title = apply_filters($this->p->cf['lca'] . '_title_seed', '', $use_post, $add_hashtags, $md_idx, $src_id);
         if (!empty($title)) {
             if ($this->p->debug->enabled) {
                 $this->p->debug->log('title seed = "' . $title . '"');
             }
         }
     }
     // check for hashtags in meta or seed title, remove and then add again after shorten
     if (preg_match('/(.*)(( #[a-z0-9\\-]+)+)$/U', $title, $match)) {
         $title = $match[1];
         $hashtags = trim($match[2]);
     } elseif (is_singular() || $use_post !== false) {
         if (!empty($add_hashtags) && !empty($this->p->options['og_desc_hashtags'])) {
             $hashtags = $this->get_hashtags($post_id, $add_hashtags);
         }
         // add_hashtags = true/false/numeric
     }
     // construct a title of our own
     if (empty($title)) {
         // $obj and $post_id are defined above, with the same test, so we should be good
         if (is_singular() || $use_post !== false) {
             if (is_singular()) {
                 $title = wp_title($separator, false, 'right');
                 if ($this->p->debug->enabled) {
                     $this->p->debug->log('is_singular wp_title() = "' . $title . '"');
                 }
             } elseif (!empty($post_id)) {
                 $title = apply_filters('wp_title', get_the_title($post_id) . ' ' . $separator . ' ', $separator, 'right');
                 if ($this->p->debug->enabled) {
                     $this->p->debug->log('post_id get_the_title() = "' . $title . '"');
                 }
             }
             // by default, use the wordpress title if an seo plugin is available
         } elseif ($this->p->is_avail['seo']['*'] == true) {
             // use separator on right for compatibility with aioseo
             $title = wp_title($separator, false, 'right');
             if ($this->p->debug->enabled) {
                 $this->p->debug->log('seo wp_title() = "' . $title . '"');
             }
         } elseif (SucomUtil::is_term_page()) {
             $term = $this->p->util->get_term_object();
             $title = apply_filters('wp_title', $term->name . ' ' . $separator . ' ', $separator, 'right');
         } elseif (SucomUtil::is_author_page()) {
             $author = $this->p->util->get_author_object();
             $title = apply_filters('wp_title', $author->display_name . ' ' . $separator . ' ', $separator, 'right');
             // category title, with category parents
         } elseif (SucomUtil::is_category_page()) {
             $title = $this->get_category_title();
             // includes parents in title string
         } else {
             /* The title text depends on the query:
              *	single post = the title of the post 
              *	date-based archive = the date (e.g., "2006", "2006 - January") 
              *	category = the name of the category 
              *	author page = the public name of the user 
              */
//.........這裏部分代碼省略.........
開發者ID:leotaillard,項目名稱:btws2016,代碼行數:101,代碼來源:webpage.php


注:本文中的SucomUtil::is_category_page方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。