'uk-alert uk-alert-warning' ) ); echo beans_output( 'beans_no_widget_notice_text', sprintf( __( '%s does not have any widget assigned!', 'beans' ), beans_get_widget_area( 'name' ) ) ); echo beans_close_markup( 'beans_no_widget_notice', 'p' ); } beans_add_filter( 'beans_widget_content_rss_output', 'beans_widget_rss_content' ); /** * Modify RSS widget content. * * @since 1.0.0 * * @return The RSS widget content. */ function beans_widget_rss_content() { $options = beans_get_widget( 'options' ); return '

' . __( 'Read feed', 'beans' ) . '

'; } beans_add_filter( 'beans_widget_content_attributes', 'beans_modify_widget_content_attributes' ); /** * Modify core widgets content attributes, so they use the default UIKit styling. * * @since 1.0.0 * * @param array $attributes The current widget attributes. * * @return array The modified widget attributes. */ function beans_modify_widget_content_attributes( $attributes ) { $type = beans_get_widget( 'type' ); $target = array( 'archives', 'categories', 'links', 'meta', 'pages', 'recent-posts', 'recent-comments' ); $current_class = isset( $attributes['class'] ) ? $attributes['class'] . ' ' : ''; if ( in_array( beans_get_widget( 'type' ), $target ) ) $attributes['class'] = $current_class . 'uk-list'; if ( $type == 'calendar' ) $attributes['class'] = $current_class . 'uk-table uk-table-condensed'; return $attributes; } beans_add_filter( 'beans_widget_content_categories_output', 'beans_modify_widget_count' ); beans_add_filter( 'beans_widget_content_archives_output', 'beans_modify_widget_count' ); /** * Modify widget count. * * @since 1.0.0 * * @param string $content The widget content. * * @return string The modified widget content. */ function beans_modify_widget_count( $content ) { $count = beans_output( 'beans_widget_count', '$1' ); if ( beans_get( 'dropdown', beans_get_widget( 'options') ) == true ) { $output = $count; } else { $output = beans_open_markup( 'beans_widget_count', 'span', 'class=tm-count' ); $output .= $count; $output .= beans_close_markup( 'beans_widget_count', 'span' ); } // Keep closing tag to avoid overwriting the inline JavaScript. return preg_replace( '#>((\s| )\((.*)\))#', '>' . $output, $content ); } beans_add_filter( 'beans_widget_content_categories_output', 'beans_remove_widget_dropdown_label' ); beans_add_filter( 'beans_widget_content_archives_output', 'beans_remove_widget_dropdown_label' ); /** * Modify widget dropdown label. * * @since 1.0.0 * * @param string $content The widget content. * * @return string The modified widget content. */ function beans_remove_widget_dropdown_label( $content ) { return preg_replace( '#]*)class="screen-reader-text"(.*?)>(.*?)#', '', $content ) ; }