Example #1
0
/**
 * Gets the proper filename (path) to use for displaying a page based on whether or not it is a single page and its general context
 * 
 * @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_general_template_single($dir, $files)
{
    if (cfct_context() == 'single') {
        $files = cfct_single_templates($dir, $files);
        if (count($files)) {
            // check to see if we're in the loop.
            global $post;
            $orig_post = $post;
            while (have_posts()) {
                the_post();
                $filename = cfct_choose_single_template($files, 'single-*');
                if (!$filename) {
                    if (file_exists(CFCT_PATH . $dir . '/single.php')) {
                        $filename = 'single.php';
                    }
                }
            }
            rewind_posts();
            $post = $orig_post;
            return $filename;
        }
    }
    return false;
}
Example #2
0
function cfct_choose_general_template_single($dir, $files)
{
    if (cfct_context() == 'single') {
        $files = cfct_single_templates($dir, $files);
        if (count($files)) {
            // TODO - check for content matches
        }
    }
    return false;
}