Пример #1
0
function enlightenment_templates_blog_post_teaser($templates)
{
    if (current_theme_supports('enlightenment-grid-loop')) {
        $templates = array_slice($templates, 0, 3, true) + array('post-teaser' => array('name' => __('Blog Post Teaser', 'enlightenment'), 'hooks' => array_keys(enlightenment_entry_hooks()), 'type' => 'special')) + array_slice($templates, 3, null, true);
    }
    return $templates;
}
Пример #2
0
function enlightenment_validate_post_formats_editor($input)
{
    foreach ($input['template_hooks'] as $post_format => $hooks) {
        if ($post_format != $input['select_post_format']) {
            unset($input['template_hooks'][$post_format]);
        }
    }
    $post_format = $input['select_post_format'];
    unset($input['select_post_format']);
    foreach ($input['template_hooks'][$post_format] as $hook => $functions) {
        if (!in_array($hook, array_keys(enlightenment_entry_hooks()))) {
            unset($input['template_hooks'][$post_format][$hook]);
        }
    }
    foreach ($input['template_hooks'][$post_format] as $hook => $functions) {
        $functions = explode(',', $functions);
        $atts = enlightenment_get_template_hook($hook);
        foreach ($functions as $key => $function) {
            if (!in_array($function, $atts['functions'])) {
                unset($functions[$key]);
            }
        }
        $input['template_hooks'][$post_format][$hook] = $functions;
    }
    $option = enlightenment_theme_option('template_hooks', array());
    $input['template_hooks'] = array_merge($option, $input['template_hooks']);
    return $input;
}