'postbypost', 'limit' => '', 'format' => 'html', 'showcount' => false, 'before' => '', 'after' => '', 'order' => 'desc', ); $attr = shortcode_atts( $default_atts, $atts, 'archives' ); if ( ! in_array( $attr['type'], array( 'yearly', 'monthly', 'daily', 'weekly', 'postbypost' ) ) ) { $attr['type'] = 'postbypost'; } if ( ! in_array( $attr['format'], array( 'html', 'option', 'custom' ) ) ) { $attr['format'] = 'html'; } $limit = intval( $attr['limit'] ); // A Limit of 0 makes no sense so revert back to the default. if ( empty( $limit ) ) { $limit = ''; } $showcount = ( false !== $attr['showcount'] && 'false' !== $attr['showcount'] ) ? true : false; $before = wp_kses( $attr['before'], $allowedposttags ); $after = wp_kses( $attr['after'], $allowedposttags ); // Get the archives $archives = wp_get_archives( array( 'type' => $attr['type'], 'limit' => $limit, 'format' => $attr['format'], 'echo' => false, 'show_post_count' => $showcount, 'before' => $before, 'after' => $after, ) ); if ( 'asc' === $attr['order'] ) { $archives = implode( "\n", array_reverse( explode( "\n", $archives ) ) ); } // Check to see if there are any archives if ( empty( $archives ) ) { $archives = '

' . __( 'Your blog does not currently have any published posts.', 'jetpack' ) . '

'; } else if ( 'option' === $attr['format'] ) { $archives = ''; } else if ( 'html' === $attr['format'] ) { $archives = ''; } return $archives; }