Exemple #1
0
/**
 * Get the name of a category from the category slug of a filename
 * 
 * @param string $file Filename 
 * @return string Category name matching the category slug of the filename
 * 
**/
function cfct_cat_filename_to_name($file)
{
    $cat = cfct_cat_filename_to_slug($file);
    $cat = get_category_by_slug($cat);
    return $cat->name;
}
Exemple #2
0
function cfct_choose_content_template_category($type = 'content', $files = null)
{
    $files = cfct_cat_templates($type, $files);
    if (count($files)) {
        foreach ($files as $file) {
            $cat_id = cfct_cat_filename_to_id($file);
            if (in_category($cat_id)) {
                $keys = array(cfct_cat_filename_to_slug($file));
                return cfct_filename($type, 'category', $keys);
            }
        }
    }
    return false;
}