ID, $meta_key, true ); /* If a meta value was found, create a list of posts in the series. */ if ( !empty( $meta_value ) ) { /* Set up the default post query arguments. */ $defaults = array( 'order' => 'DESC', 'orderby' => 'ID', 'include' => '', 'exclude' => '', 'post_type' => 'any', 'numberposts' => -1, 'meta_key' => $meta_key, 'meta_value' => $meta_value, 'echo' => true ); /* Allow developers to override the arguments used. */ $args = apply_filters( 'custom_field_series_args', $args ); $args = wp_parse_args( $args, $defaults ); /* Get all posts in the current series. */ $series_posts = get_posts( $args ); /* If posts were found, display them. */ if ( !empty( $series_posts ) ) { /* Format the series class with the name of the series. */ $class = str_replace( array( '_', ' ', ' ' ) , '-', $series_meta ); $class = preg_replace('/[^A-Za-z0-9-]/', '', $class ); $class = strtolower( $class ); /* Create the opening wrapper div, title, and list element. */ $series = '
'; $series .= '

' . __( 'Articles in this series', $textdomain) . '

'; $series .= '
'; } } /* Allow developers to overwrite the HTML of the series. */ $series = apply_filters( 'custom_field_series', $series ); /* If $echo is set to true, display the series. */ if ( !empty( $args['echo'] ) ) echo $series; /* If $echo is not set to true, return the series. */ else return $series; } ?>