Пример #1
0
function enlightenment_teaser_post_format_hooks()
{
    if (current_theme_supports('enlightenment-grid-loop') && !enlightenment_is_lead_post() && !is_singular() && '' != get_post_format()) {
        enightenment_clear_entry_hooks();
        if (has_post_format('gallery')) {
            add_action('enlightenment_entry_header', 'enlightenment_entry_gallery');
            add_action('enlightenment_entry_header', 'the_title', 10, 2);
            add_action('enlightenment_entry_footer', 'enlightenment_entry_meta');
        } elseif (has_post_format('image')) {
            add_action('enlightenment_entry_header', 'enlightenment_entry_image');
            add_action('enlightenment_entry_header', 'the_title', 10, 2);
            add_action('enlightenment_entry_footer', 'enlightenment_entry_meta');
        } elseif (has_post_format('video')) {
            add_action('enlightenment_entry_header', 'enlightenment_entry_video');
            add_action('enlightenment_entry_header', 'the_title', 10, 2);
            add_action('enlightenment_entry_footer', 'enlightenment_entry_meta');
        } elseif (has_post_format('audio')) {
            add_action('enlightenment_entry_header', 'the_post_thumbnail');
            add_action('enlightenment_entry_header', 'enlightenment_entry_audio');
            add_action('enlightenment_entry_header', 'the_title', 10, 2);
            add_action('enlightenment_entry_footer', 'enlightenment_entry_meta');
        } elseif (has_post_format('aside')) {
            add_action('enlightenment_entry_content', 'the_content');
            add_action('enlightenment_entry_footer', 'enlightenment_entry_meta');
        } elseif (has_post_format('link')) {
            add_action('enlightenment_entry_header', 'the_title', 10, 2);
            add_action('enlightenment_entry_footer', 'enlightenment_entry_meta');
        } elseif (has_post_format('quote')) {
            add_action('enlightenment_entry_header', 'enlightenment_entry_blockquote');
            add_action('enlightenment_entry_footer', 'enlightenment_entry_meta');
        } elseif (has_post_format('status')) {
            add_action('enlightenment_entry_content', 'enlightenment_entry_author_avatar');
            add_action('enlightenment_entry_content', 'the_content');
            add_action('enlightenment_entry_footer', 'enlightenment_entry_meta');
        } elseif (has_post_format('chat')) {
            add_action('enlightenment_entry_header', 'the_title', 10, 2);
            add_action('enlightenment_entry_content', 'the_content');
            add_action('enlightenment_entry_footer', 'enlightenment_entry_meta');
        }
    }
}
Пример #2
0
function enlightenment_add_post_formats_actions()
{
    if (is_admin() || is_singular() || '' == get_post_format()) {
        return;
    }
    $hooks = enlightenment_theme_option('template_hooks');
    $format = get_post_format();
    if (current_theme_supports('enlightenment-grid-loop') && !enlightenment_is_lead_post()) {
        $format = $format . '-teaser';
    }
    if (isset($hooks[$format])) {
        foreach ($hooks[$format] as $hook => $functions) {
            remove_all_actions($hook, 10);
            if (!empty($functions)) {
                foreach ($functions as $function) {
                    add_action($hook, $function, 10, apply_filters('enlightenment_template_actions_accepted_args', 2));
                }
            }
        }
    }
}
Пример #3
0
function enlightenment_post_thumbnail_size($size)
{
    if ('full-screen' == enlightenment_current_sidebar_name() && doing_action('enlightenment_custom_before_entry_header')) {
        global $enlightenment_custom_query_name;
        if ('custom_query_widget_slider' == $enlightenment_custom_query_name) {
            return 'full';
        }
    } elseif (!enlightenment_is_lead_post()) {
        return 'enlightenment-teaser-thumb';
    } elseif ('small' == enlightenment_theme_option('thumbnails_size')) {
        return 'thumbnail';
    }
    return 'enlightenment-blog-thumb';
}
Пример #4
0
function enlightenment_add_post_teaser_actions()
{
    if (current_theme_supports('enlightenment-grid-loop') && !enlightenment_is_lead_post() && '' == get_post_format()) {
        $hooks = enlightenment_theme_option('template_hooks');
        $template = 'post-teaser';
        if (isset($hooks[$template])) {
            foreach ($hooks[$template] as $hook => $functions) {
                remove_all_actions($hook, 10);
                if (!empty($functions)) {
                    foreach ($functions as $function) {
                        add_action($hook, $function, 10, apply_filters('enlightenment_template_actions_accepted_args', 2));
                    }
                }
            }
        } else {
            enlightenment_teaser_entry_hooks();
        }
    }
}
Пример #5
0
function enlightenment_project_teaser_actions()
{
    if (current_theme_supports('jetpack-portfolio') && class_exists('Jetpack') && in_array('custom-content-types', Jetpack::get_active_modules())) {
        if ((is_post_type_archive('jetpack-portfolio') || is_tax('jetpack-portfolio-type') || is_tax('jetpack-portfolio-tag')) && current_theme_supports('enlightenment-grid-loop') && !enlightenment_is_lead_post()) {
            enightenment_clear_entry_hooks();
            add_action('enlightenment_entry_header', 'the_post_thumbnail');
            add_action('enlightenment_entry_header', 'the_title', 10, 2);
        }
    }
}
Пример #6
0
function enlightenment_grid_post_class($classes)
{
    if (is_singular() || is_404()) {
        return $classes;
    }
    $grid = enlightenment_get_grid(enlightenment_current_grid());
    if (enlightenment_is_lead_post()) {
        $classes[] = apply_filters('enlightenment_lead_post_class', 'entry-lead');
    } elseif (1 < $grid['content_columns']) {
        $classes[] = apply_filters('enlightenment_teaser_post_class', 'entry-teaser');
        global $enlightenment_post_counter;
        $teaser_count = $enlightenment_post_counter - enlightenment_current_lead_posts();
        if (0 == $teaser_count % 2) {
            $classes[] = apply_filters('enlightenment_teaser_even_class', 'teaser-even');
        } else {
            $classes[] = apply_filters('enlightenment_teaser_odd_class', 'teaser-odd');
        }
        $teaser_row_position = $teaser_count % $grid['content_columns'];
        if (0 == $teaser_row_position) {
            $teaser_row_position = $grid['content_columns'];
        }
        $classes[] = apply_filters('enlightenment_teaser_row_count_class', 'teaser-row-pos-' . $teaser_row_position);
    }
    return $classes;
}