本文整理汇总了PHP中td_module类的典型用法代码示例。如果您正苦于以下问题:PHP td_module类的具体用法?PHP td_module怎么用?PHP td_module使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了td_module类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2:
function __construct($post = '')
{
//run the parent constructor
parent::__construct($post);
//read post settings
$this->td_post_theme_settings = get_post_meta($post->ID, 'td_post_theme_settings', true);
$this->is_single = is_single();
}
示例3:
function __construct($post)
{
//run the parrent constructor
parent::__construct($post);
}
示例4:
function get_author($show_stars_on_review = '')
{
$buffy = '';
$buffy .= '<div class="td-clear-author"></div>';
$buffy .= parent::get_author(false);
return $buffy;
}
示例5:
function get_image($thumbType)
{
$attachment_id = get_post_thumbnail_id($this->post->ID);
if (empty($attachment_id)) {
//print_r($this->post);
if (current_user_can('edit_posts')) {
$td_edit_link = '<a class="td-admin-edit" href="' . get_edit_post_link($this->post->ID) . '">edit</a>';
} else {
$td_edit_link = '';
}
$buffy = '';
$buffy .= '<div class="thumb-wrap">';
$buffy .= '<a href="' . $this->href . '" rel="bookmark">';
if ($this->post->post_type == 'page') {
$buffy .= $td_edit_link . '<img src="' . get_template_directory_uri() . '/images/no-img-page.png" alt="" title="" />';
} else {
$buffy .= $td_edit_link . '<img src="' . get_template_directory_uri() . '/images/no-img-post.png" alt="" title="" />';
}
$buffy .= '</a>';
$buffy .= '</div>';
return $buffy;
} else {
return parent::get_image($thumbType);
}
}