term_id] = $term->name;
}
}
}
else {
$qt = 'SELECT * FROM ' . $wpdb->terms . ' AS t INNER JOIN ' . $wpdb->term_taxonomy . ' AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = "' . $taxonomy . '" AND tt.count > 0 ORDER BY t.term_id DESC LIMIT 0 , 30';
$terms = $wpdb->get_results($qt, ARRAY_A);
if ($terms && !is_wp_error($terms)) {
foreach ($terms as $term) {
$term_coll[$term['term_id']] = $term['name'];
}
}
}
return $term_coll;
}
}
if (!function_exists('lvca_entry_terms_list')) {
function lvca_entry_terms_list($taxonomy = 'category', $separator = ', ', $before = ' ', $after = ' ') {
global $post;
$output = '';
$output .= get_the_term_list($post->ID, $taxonomy, $before, $separator, $after);
$output .= '';
return $output;
}
}
if (!function_exists('lvca_get_posts')) {
function lvca_get_posts() {
$list = array();
$args = $args = array(
'posts_per_page' => -1,
'offset' => 0,
'category' => '',
'category_name' => '',
'orderby' => 'date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'post',
'post_mime_type' => '',
'post_parent' => '',
'author' => '',
'post_status' => 'publish',
'suppress_filters' => true
);
$posts = get_posts($args);
if (!empty ($posts)) {
foreach ($posts as $post) {
$list[$post->ID] = $post->post_title;
}
}
return $list;
}
}
if (!function_exists('lvca_get_taxonomy_info')) {
function lvca_get_taxonomy_info($taxonomy) {
$output = '';
$terms = get_the_terms(get_the_ID(), $taxonomy);
if (!empty($terms) && !is_wp_error($terms)) {
$output .= '
';
$term_count = 0;
foreach ($terms as $term) {
if ($term_count != 0)
$output .= ', ';
$output .= '
' . $term->name . '';
$term_count = $term_count + 1;
}
$output .= '
';
}
return $output;
}
}
if (!function_exists('lvca_entry_published')) {
function lvca_entry_published($format = "M d, Y") {
$published = '' . sprintf(get_the_time($format)) . '';
return $published;
$link = '' . '' . '' . get_the_time($format) . '' . '';
return $link;
}
}
if (!function_exists('lvca_entry_author')) {
function lvca_entry_author() {
$author = '' . esc_html__('By ', 'livemesh-vc-addons'). '' . esc_html(get_the_author_meta('display_name')) . '';
return $author;
}
}
/** Isotope filtering support for Portfolio pages * */
if (!function_exists('lvca_get_taxonomy_terms_filter')) {
function lvca_get_taxonomy_terms_filter($taxonomy, $chosen_terms = array()) {
$output = '';
if (empty($chosen_terms))
$terms = get_terms($taxonomy);
else
$terms = $chosen_terms;
if (!empty($terms) && !is_wp_error($terms)) {
$output .= '';
$output .= '
';
$segment_count = 1;
foreach ($terms as $term) {
$output .= '
';
$segment_count++;
}
$output .= '
';
}
return $output;
}
}
/* Return the css class name to help achieve the number of columns specified */
if (!function_exists('lvca_get_column_class')) {
function lvca_get_column_class($column_size = 3, $no_margin = false) {
$style_class = 'lvca-threecol';
$no_margin = lvca_to_boolean($no_margin); // make sure it is not string
$column_styles = array(
1 => 'lvca-twelvecol',
2 => 'lvca-sixcol',
3 => 'lvca-fourcol',
4 => 'lvca-threecol',
5 => 'lvca-onefifthcol',
6 => 'lvca-twocol',
12 => 'lvca-onecol'
);
if (array_key_exists($column_size, $column_styles) && !empty($column_styles[$column_size])) {
$style_class = $column_styles[$column_size];
}
$style_class = $no_margin ? ($style_class . ' lvca-zero-margin') : $style_class;
return $style_class;
}
}
/*
* Converting string to boolean is a big one in PHP
*/
if (!function_exists('lvca_to_boolean')) {
function lvca_to_boolean($value) {
if (!isset($value))
return false;
if ($value == 'true' || $value == '1')
$value = true;
elseif ($value == 'false' || $value == '0')
$value = false;
return (bool)$value; // Make sure you do not touch the value if the value is not a string
}
}
/*
* Get icon font given a font family
*/
if (!function_exists('lvca_get_icon')) {
function lvca_get_icon($icon_class) {
return '';
}
}