function bepro_listing_types_column($columns, $column, $id)
{
    if ($column == 'thumb') {
        $image = '';
        $thumbnail_id = get_bepro_listings_term_meta($id, 'thumbnail_id', true);
        if ($thumbnail_id) {
            $image = wp_get_attachment_url($thumbnail_id);
        } else {
            $image = bepro_listings_placeholder_img_src();
        }
        $columns .= '<img src="' . $image . '" alt="Thumbnail" class="wp-post-image" height="48" width="48" />';
    }
    return $columns;
}
function bepro_cat_templates($cat, $url_input, $template = 0)
{
    $no_img = plugins_url("images/no_img.jpg", __FILE__);
    $url = $url_input . "?filter_search=1&l_type=" . $cat->term_id;
    $cat_list = "";
    if ($template == 1) {
        $thumb_id = get_bepro_listings_term_meta($cat->term_id, "thumbnail_id");
        $img = empty($thumb_id) ? $no_img : wp_get_attachment_url($thumb_id);
        $cat_list .= "<div class='cat_list_item'>\n\t\t\t<div class='cat_img'><a href='" . $url . "'><img src='" . $img . "' /></a></div>\n\t\t\t<div class='cat_title'><a href='" . $url . "'>" . $cat->name . "&nbsp;(" . $cat->count . ")</a></div>\n\t\t\t</div>\n\t\t\t";
    } else {
        if ($template == 2) {
            $thumb_id = get_bepro_listings_term_meta($cat->term_id, "thumbnail_id");
            $img = empty($thumb_id) ? $no_img : wp_get_attachment_url($thumb_id);
            $cat_list .= "<div class='cat_list_item'>\n\t\t\t<div class='cat_img'><a href='" . $url . "'><img src='" . $img . "' /></a></div>\n\t\t\t<div class='cat_title'><a href='" . $url . "'>" . $cat->name . "&nbsp;(" . $cat->count . ")</a></div>\n\t\t\t<div class='cat_desc'>" . $cat->description . "</div>\n\t\t\t</div>\n\t\t\t";
        } else {
            if ($template == 3) {
                $sub_categories = get_terms('bepro_listing_types', 'orderby=count&hide_empty=0&parent=' . $cat->term_id);
                $cat_list = "<div class='cat_list_item'>\n\t\t\t<div class='cat_title cat_head'><a href='" . $url . "'>" . $cat->name . "&nbsp;(" . $cat->count . ")</a></div>\n\t\t\t<div class='cat_desc'>" . $cat->description . "</div>\n\t\t\t";
                if (!empty($sub_categories)) {
                    $cat_list .= "<ul>";
                    foreach ($sub_categories as $sub_cat) {
                        $sub_url = $url_input . "?filter_search=1&l_type=" . $sub_cat->term_id;
                        $cat_list .= "<li><a href='" . $sub_url . "'>" . $sub_cat->name . "&nbsp;(" . $sub_cat->count . ")</a></li>";
                    }
                    $cat_list .= "</ul>";
                }
                $cat_list .= "</div>";
            } else {
                $sub_categories = get_terms('bepro_listing_types', 'orderby=count&hide_empty=0&parent=' . $cat->term_id);
                $cat_list = "<div class='cat_list_item'>\n\t\t\t<div class='cat_title cat_head'><a href='" . $url . "'>" . $cat->name . "&nbsp;(" . $cat->count . ")</a></div>";
                if (!empty($sub_categories)) {
                    $cat_list .= "<ul>";
                    foreach ($sub_categories as $sub_cat) {
                        $sub_url = $base_url . "?filter_search=1&l_type=" . $sub_cat->term_id;
                        $cat_list .= "<li><a href='" . $sub_url . "'>" . $sub_cat->name . "&nbsp;(" . $sub_cat->count . ")</a></li>";
                    }
                    $cat_list .= "</ul>";
                }
                $cat_list .= "</div>";
            }
        }
    }
    return $cat_list;
}
function bepro_get_total_cat_cost($post_id)
{
    $types = get_the_terms($post_id, 'bepro_listing_types');
    $cost = 0;
    if (@$types) {
        foreach ($types as $type) {
            $cost += get_bepro_listings_term_meta($type->term_id, 'bepro_flat_fee', true);
        }
    }
    return $cost;
}