'-1', 'echo' => true, 'post_types' => array( 'page', 'post' ), 'taxonomies' => array( 'category' ), 'show_archives' => true, 'show_posts_by_category' => true, 'before' => '
', 'after' => '
', 'before_title' => '

', 'after_title' => '

' ); $args = wp_parse_args( $args, $defaults ); // Allow child themes/plugins to filter here. $args = apply_filters( 'woothemes_archives_sitemap_args', $args ); $html = ''; do_action( 'woothemes_archives_sitemap_before', $args ); // Post types output. if ( 0 < count( $args['post_types'] ) ) { foreach ( $args['post_types'] as $k => $v ) { $html .= $woothemes_archives->sitemap->render_posts_html( $v, $args ); } } // Taxonomies output. if ( 0 < count( $args['taxonomies'] ) ) { foreach ( $args['taxonomies'] as $k => $v ) { $html .= $woothemes_archives->sitemap->render_terms_html( $v, $args ); } } // Show archives. if ( true == $args['show_archives'] ) { $html .= $woothemes_archives->sitemap->render_archives_html( $args ); } // Show posts by category. if ( true == $args['show_posts_by_category'] ) { $html .= $woothemes_archives->sitemap->render_posts_by_category_html( $args ); } // Allow child themes/plugins to filter here. $html = apply_filters( 'woothemes_archives_sitemap_html', $html, $args ); if ( $args['echo'] != true ) { return $html; } // Should only run is "echo" is set to true. echo $html; do_action( 'woothemes_archives_sitemap_after', $args ); // Only if "echo" is set to true. } // End woothemes_archives_sitemap() } if ( ! function_exists( 'woothemes_archives_sitemap_shortcode' ) ) { /** * The shortcode function for the "Timeline" view. * @since 1.0.0 * @param array $atts Shortcode attributes. * @param string $content If the shortcode is a wrapper, this is the content being wrapped. * @return string Output using the template tag. */ function woothemes_archives_sitemap_shortcode ( $atts, $content = null ) { $args = (array)$atts; $defaults = array( 'limit' => '-1', 'echo' => true, 'post_types' => array( 'page', 'post' ), 'taxonomies' => array( 'category' ), 'show_archives' => true, 'show_posts_by_category' => true, 'before' => '
', 'after' => '
', 'before_title' => '

', 'after_title' => '

' ); $args = shortcode_atts( $defaults, $atts ); // Make sure we return and don't echo. $args['echo'] = false; // Fix integers. if ( isset( $args['limit'] ) ) $args['limit'] = intval( $args['limit'] ); // Fix arrays. if ( isset( $args['post_types'] ) && ! is_array( $args['post_types'] ) ) $args['post_types'] = explode( ',', $args['post_types'] ); if ( isset( $args['taxonomies'] ) && ! is_array( $args['taxonomies'] ) ) $args['taxonomies'] = explode( ',', $args['taxonomies'] ); // Fix booleans. foreach ( array( 'show_archives', 'show_posts_by_category' ) as $k => $v ) { if ( isset( $args[$v] ) && ( 'true' == $args[$v] ) ) { $args[$v] = true; } else { $args[$v] = false; } } return woothemes_archives_sitemap( $args ); } // End woothemes_archives_sitemap_shortcode() } add_shortcode( 'woothemes_archives_sitemap', 'woothemes_archives_sitemap_shortcode' ); ?>