/** * Retrieve the value of post elements */ public function get_post_value($handle, $separator, $function, $meta) { $base = new Essential_Grid_Base(); $text = ''; switch ($handle) { //Post elements case 'post_id': $text = $base->getVar($this->post, 'ID', ''); break; case 'post_url': $post_id = $base->getVar($this->post, 'ID', ''); $text = get_permalink($post_id); break; case 'title': $text = $base->getVar($this->post, 'post_title', ''); break; case 'excerpt': $text = trim($base->getVar($this->post, 'post_excerpt')); if (empty($text)) { //strip essential grid shortcode here $text = do_shortcode($base->strip_essential_shortcode($base->getVar($this->post, 'post_content'))); $text = preg_replace("/<style\\b[^>]*>(.*?)<\\/style>/s", "", $text); $text = preg_replace("/<script\\b[^>]*>(.*?)<\\/script>/s", "", $text); } $text = strip_tags($text); //,"<b><br><br/><i><strong><small>" break; case 'meta': $m = new Essential_Grid_Meta(); $text = $m->get_meta_value_by_handle($this->post['ID'], $meta); break; case 'alias': $text = $base->getVar($this->post, 'post_name'); break; case 'content': $text = apply_filters('the_content', $base->getVar($this->post, 'post_content')); break; case 'link': $text = get_permalink($this->post['ID']); break; case 'date': $postDate = $base->getVar($this->post, "post_date_gmt"); $text = $base->convert_post_date($postDate); break; case 'date_modified': $dateModified = $base->getVar($this->post, "post_modified"); $text = $base->convert_post_date($dateModified); break; case 'author_name': $authorID = $base->getVar($this->post, 'post_author'); $text = get_the_author_meta('display_name', $authorID); break; case 'num_comments': $text = $base->getVar($this->post, 'comment_count'); break; case 'cat_list': $use_taxonomies = false; $postCatsIDs = $base->getVar($this->post, 'post_category'); if (empty($postCatsIDs) && isset($this->post['post_type'])) { $postCatsIDs = array(); $obj = get_object_taxonomies($this->post['post_type']); if (!empty($obj) && is_array($obj)) { foreach ($obj as $tax) { $use_taxonomies[] = $tax; $new_terms = get_the_terms($this->post['ID'], $tax); if (is_array($new_terms) && !empty($new_terms)) { foreach ($new_terms as $term) { $postCatsIDs[$term->term_id] = $term->term_id; } } } } } $text = $base->get_categories_html_list($postCatsIDs, $function, $separator, $use_taxonomies); break; case 'tag_list': $text = $base->get_tags_html_list($this->post['ID'], $separator, $function); break; } return $text; }