Ejemplo n.º 1
0
 public function render($template = 'liveblog-single-entry.php')
 {
     $output = apply_filters('liveblog_pre_entry_output', '', $this);
     if (!empty($output)) {
         return $output;
     }
     if (empty($this->comment->comment_content)) {
         return $output;
     }
     $entry = $this->get_fields_for_render();
     $entry = apply_filters('liveblog_entry_template_variables', $entry);
     return WPCOM_Liveblog::get_template_part($template, $entry);
 }
 /**
  * Renders lazyloading-specific admin notices.
  *
  * @wp-hook admin_notices
  *
  * @return void
  */
 public static function admin_notices()
 {
     echo WPCOM_Liveblog::get_template_part('lazyload-notice.php', array('plugin' => 'Lazyload Liveblog Entries'));
 }
 /**
  * Builds the box to display key entries
  *
  * @param $atts
  * @return mixed
  */
 public static function shortcode($atts)
 {
     global $post;
     if (!is_single()) {
         return;
     }
     // Define the default shortcode attributes.
     $atts = shortcode_atts(array('title' => 'Key Events'), $atts);
     // The args to pass into the entry query.
     $args = array('meta_key' => self::meta_key, 'meta_value' => self::meta_value);
     $limit = get_post_meta($post->ID, self::meta_key_limit, true);
     if (isset($limit)) {
         $args['number'] = $limit;
     }
     // Build the entry query.
     $entry_query = new WPCOM_Liveblog_Entry_Query($post->ID, WPCOM_Liveblog::key);
     // Execute the entry query with the previously defined args.
     $entries = (array) $entry_query->get_all($args);
     // Grab the template to use.
     $template = self::get_current_template($post->ID);
     // Only run the shortcode on an archived or enabled post.
     if (WPCOM_Liveblog::get_liveblog_state($post->ID)) {
         // Render the actual template.
         return WPCOM_Liveblog::get_template_part('liveblog-key-events.php', array('entries' => $entries, 'title' => $atts['title'], 'template' => $template[0], 'wrap' => $template[1], 'class' => $template[2]));
     }
 }