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


PHP td_module::get_item_scope_meta方法代碼示例

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


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

示例1:

 /**
  * This method outputs the item scope for SINGLE templates. If you are looking for the modules @see td_module::get_item_scope_meta()
  * @updated 23 july 2015
  *  - if the module that uses this class is not on a single page, we use the @see td_module::get_item_scope_meta() this allows
  * us to output normal module item scope insted of no item scope like it was before this update
  * @return string
  */
 function get_item_scope_meta()
 {
     if (!is_single()) {
         return parent::get_item_scope_meta();
         // get a normal item scope if we're in a loop - like on a blog style loop
     }
     $buffy = '';
     //the vampire slayer
     $buffy .= parent::get_item_scope_meta();
     // if we have a review, we must add additional stuff
     if (td_review::has_review($this->td_review)) {
         // the item that is reviewd
         $buffy .= '<meta itemprop="itemReviewed " content = "' . $this->title_attribute . '">';
         if (!empty($this->td_review['review'])) {
             $buffy .= '<meta itemprop="about" content = "' . esc_attr($this->td_review['review']) . '">';
         } else {
             //we have no review text :| get a excerpt for the about meta thing
             if ($this->post->post_excerpt != '') {
                 $td_post_excerpt = $this->post->post_excerpt;
             } else {
                 $td_post_excerpt = td_util::excerpt($this->post->post_content, 25);
             }
             $buffy .= '<meta itemprop="about" content = "' . esc_attr($td_post_excerpt) . '">';
         }
         // review rating
         $buffy .= '<span class="td-page-meta" itemprop="reviewRating" itemscope itemtype="' . td_global::$http_or_https . '://schema.org/Rating">';
         $buffy .= '<meta itemprop="worstRating" content = "1">';
         $buffy .= '<meta itemprop="bestRating" content = "5">';
         $buffy .= '<meta itemprop="ratingValue" content = "' . td_review::calculate_total_stars($this->td_review) . '">';
         $buffy .= ' </span>';
     }
     return $buffy;
 }
開發者ID:ryandong82,項目名稱:colorfulladysite,代碼行數:40,代碼來源:td_module_single_base.php


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