'', 'align' => 'alignnone', 'width' => '', 'caption' => '' ); $attr = shortcode_atts($defaults, $attr); // If the width is less than 1 or there is no caption, return the content wrapped between the [caption] tags if ($attr['width'] < 1 || empty($attr['caption'])) { return $content; } // Set up the attributes for the caption
$attributes = (!empty($attr['id']) ? ' id="' . esc_attr($attr['id']) . '"' : '' ); $attributes .= ' class="thumbnail wp-caption ' . esc_attr($attr['align']) . '"'; $attributes .= ' style="width: ' . esc_attr($attr['width']) . 'px"'; $output = ''; $output .= do_shortcode($content); $output .= '
' . $attr['caption'] . '
'; $output .= '
'; return $output; } add_filter('img_caption_shortcode', 'kadence_caption', 10, 3); /** * Clean up the_excerpt() */ function kadence_excerpt_length($length) { return POST_EXCERPT_LENGTH; } function kadence_remove_more_link_scroll( $link ) { $link = preg_replace( '|#more-[0-9]+|', '', $link ); return $link; } add_filter( 'the_content_more_link', 'kadence_remove_more_link_scroll' ); function kadence_excerpt_more($more) { return ' … ' . __('Continued', 'virtue') . ''; } add_filter('excerpt_length', 'kadence_excerpt_length'); add_filter('excerpt_more', 'kadence_excerpt_more'); /** * Add additional classes onto widgets * * @link http://wordpress.org/support/topic/how-to-first-and-last-css-classes-for-sidebar-widgets */ function kadence_widget_first_last_classes($params) { global $my_widget_num; $this_id = $params[0]['id']; $arr_registered_widgets = wp_get_sidebars_widgets(); if (!$my_widget_num) { $my_widget_num = array(); } if (!isset($arr_registered_widgets[$this_id]) || !is_array($arr_registered_widgets[$this_id])) { return $params; } if (isset($my_widget_num[$this_id])) { $my_widget_num[$this_id] ++; } else { $my_widget_num[$this_id] = 1; } $class = 'class="widget-' . $my_widget_num[$this_id] . ' '; if ($my_widget_num[$this_id] == 1) { $class .= 'widget-first '; } elseif ($my_widget_num[$this_id] == count($arr_registered_widgets[$this_id])) { $class .= 'widget-last '; } $params[0]['before_widget'] = preg_replace('/class=\"/', "$class", $params[0]['before_widget'], 1); return $params; } add_filter('dynamic_sidebar_params', 'kadence_widget_first_last_classes');