Exemplo n.º 1
0
/**
 * Handle content template selection for feed requests. Leverages single context with a feed- prefix.
 * 
 * @param string $dir Directory to use for selecting the template file
 * @param array $files A list of files to loop through
 * @return mixed Path to the file, false if no file exists
 * 
**/
function cfct_choose_content_template_feed($type = 'content')
{
    $files = cfct_files(CFCT_PATH . $type);
    $files = cfct_filter_files($files, 'feed-');
    if (count($files)) {
        $filename = cfct_choose_single_template($files, 'feed-*');
        return $filename;
    }
    return false;
}
Exemplo n.º 2
0
function cfct_choose_content_template($type = 'content')
{
    $files = cfct_files(CFCT_PATH . $type);
    $filename = cfct_choose_single_template($files);
    if (cfct_context() == 'page' && file_exists(CFCT_PATH . $type . '/page.php')) {
        $filename = 'page.php';
    }
    if (!$filename) {
        $filename = cfct_default_file($type);
    }
    return apply_filters('cfct_choose_content_template', $filename);
}