当前位置: 首页>>代码示例>>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;未经允许,请勿转载。