本文整理汇总了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;
}