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(); }
function __construct($post) { //run the parrent constructor parent::__construct($post); }
function __construct($post) { parent::__construct($post); }
/** * 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; }
function get_author($show_stars_on_review = '') { $buffy = ''; $buffy .= '<div class="td-clear-author"></div>'; $buffy .= parent::get_author(false); return $buffy; }
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); } }