function enlightenment_register_dynamic_sidebars() { $sidebars = (array) enlightenment_theme_option('sidebars'); foreach ($sidebars as $sidebar => $atts) { $before = ''; $after = ''; if (current_theme_supports('enlightenment-grid-loop') && isset($atts['grid'])) { $grid = enlightenment_get_grid($atts['grid']); $before = enlightenment_open_tag('div', $grid['entry_class']); $after = enlightenment_close_tag('div'); } register_sidebar(array('name' => $atts['name'], 'id' => $sidebar, 'before_widget' => $before . '<aside id="%1$s" class="widget %2$s">' . "\n", 'after_widget' => '</aside>' . $after . "\n", 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' . "\n")); } }
function enlightenment_excerpt_length($length) { if (is_singular()) { return $length; } if (doing_action('enlightenment_after_header')) { return 18; } $grid = enlightenment_get_grid(enlightenment_current_grid()); if (3 == $grid['content_columns']) { return 24; } if (4 == $grid['content_columns']) { return 18; } return $length; }
function enlightenment_close_sidebar_row() { $sidebars = enlightenment_theme_option('sidebars'); $sidebar = enlightenment_dynamic_sidebar(); if (isset($sidebars[$sidebar]) && isset($sidebars[$sidebar]['grid'])) { $grid = enlightenment_get_grid($sidebars[$sidebar]['grid']); if (1 < $grid['content_columns']) { enlightenment_close_container(); } } }
function enlightenment_custom_query_widget_post_class($class) { global $enlightenment_custom_widget_instance; if ('slider' == $enlightenment_custom_widget_instance['type'] || 'carousel' == $enlightenment_custom_widget_instance['type']) { $class .= ' custom-entry-lead'; } elseif (current_theme_supports('enlightenment-grid-loop')) { global $enlightenment_custom_grid; $grid = enlightenment_get_grid($enlightenment_custom_grid); $class .= ' ' . $grid['entry_class']; } if (current_theme_supports('post-thumbnails') && has_post_thumbnail()) { $class .= ' custom-entry-has-thumbnail'; } $class .= ' custom-post-type-' . get_post_type(); return $class; }
function enlightenment_enqueue_masonry_script() { if (is_singular() || is_404()) { return; } $grid = enlightenment_get_grid(enlightenment_current_grid()); if (1 == $grid['content_columns']) { return; } $entry_class = explode(' ', $grid['entry_class']); $column_width = '.' . $entry_class[0]; $defaults = array('masonry' => true, 'masonry_args' => array('container' => '#content', 'columnWidth' => '#content .' . $entry_class[0], 'itemSelector' => '#content .hentry', 'transitionDuration' => '0.7s')); $args = get_theme_support('enlightenment-grid-loop'); if (is_array($args)) { $args = array_shift($args); } else { $args = array(); } $args = apply_filters('enlightenment_masonry_script_args', $args); $args = wp_parse_args($args, $defaults); if ($args['masonry']) { wp_enqueue_script('masonry'); wp_localize_script('masonry', 'enlightenment_masonry_args', $args['masonry_args']); } }