$max_depth ) $max_depth = $depth; endif; endforeach; return $max_depth; else: return 0; endif; } } if ( !function_exists( 'sp_array_between' ) ) { function sp_array_between ( $array = array(), $delimiter = 0, $index = 0 ) { $keys = array_keys( $array, $delimiter ); if ( array_key_exists( $index, $keys ) ): $offset = $keys[ $index ]; $end = sizeof( $array ); if ( array_key_exists( $index + 1, $keys ) ) $end = $keys[ $index + 1 ]; $length = $end - $offset; $array = array_slice( $array, $offset, $length ); endif; return $array; } } if ( !function_exists( 'sp_array_value' ) ) { function sp_array_value( $arr = array(), $key = 0, $default = null ) { if ( array_key_exists( $key, $arr ) ) $subset = $arr[ $key ]; else $subset = $default; return $subset; } } if ( !function_exists( 'sp_array_combine' ) ) { function sp_array_combine( $keys = array(), $values = array() ) { $output = array(); foreach ( $keys as $key ): if ( array_key_exists( $key, $values ) ) $output[ $key ] = $values[ $key ]; else $output[ $key ] = array(); endforeach; return $output; } } if ( !function_exists( 'sp_get_cpt_labels' ) ) { function sp_get_cpt_labels( $name, $singular_name ) { $labels = array( 'name' => $name, 'singular_name' => $singular_name, 'all_items' => sprintf( __( 'All %s', 'sportspress' ), $name ), 'add_new_item' => sprintf( __( 'Add New %s', 'sportspress' ), $singular_name ), 'edit_item' => sprintf( __( 'Edit %s', 'sportspress' ), $singular_name ), 'new_item' => sprintf( __( 'New %s', 'sportspress' ), $singular_name ), 'view_item' => sprintf( __( 'View %s', 'sportspress' ), $singular_name ), 'search_items' => sprintf( __( 'Search %s', 'sportspress' ), $name ), 'not_found' => sprintf( __( 'No %s found', 'sportspress' ), $name ), 'not_found_in_trash' => sprintf( __( 'No %s found in trash', 'sportspress' ), $name ), 'parent_item_colon' => sprintf( __( 'Parent %s', 'sportspress' ), $singular_name ) . ':' ); return $labels; } } if ( !function_exists( 'sp_get_tax_labels' ) ) { function sp_get_tax_labels( $name, $singular_name ) { $labels = array( 'name' => $name, 'singular_name' => $singular_name, 'all_items' => sprintf( __( 'All %s', 'sportspress' ), $name ), 'edit_item' => sprintf( __( 'Edit %s', 'sportspress' ), $singular_name ), 'view_item' => sprintf( __( 'View %s', 'sportspress' ), $singular_name ), 'update_item' => sprintf( __( 'Update %s', 'sportspress' ), $singular_name ), 'add_new_item' => sprintf( __( 'Add New %s', 'sportspress' ), $singular_name ), 'new_item_name' => sprintf( __( 'New %s Name', 'sportspress' ), $singular_name ), 'parent_item' => sprintf( __( 'Parent %s', 'sportspress' ), $singular_name ), 'parent_item_colon' => sprintf( __( 'Parent %s', 'sportspress' ), $singular_name ) . ':', 'search_items' => sprintf( __( 'Search %s', 'sportspress' ), $name ), 'not_found' => sprintf( __( 'No %s found', 'sportspress' ), $name ) ); return $labels; } } if ( !function_exists( 'sp_dropdown_taxonomies' ) ) { function sp_dropdown_taxonomies( $args = array() ) { $defaults = array( 'show_option_all' => false, 'show_option_none' => false, 'taxonomy' => null, 'name' => null, 'selected' => null, ); $args = array_merge( $defaults, $args ); $terms = get_terms( $args['taxonomy'] ); $name = ( $args['name'] ) ? $args['name'] : $args['taxonomy']; if ( $terms ) { printf( '' ); } } } if ( !function_exists( 'sp_the_posts' ) ) { function sp_the_posts( $post_id = null, $meta = 'post', $before = '', $sep = ', ', $after = '', $delimiter = ' - ' ) { if ( ! isset( $post_id ) ) global $post_id; $ids = get_post_meta( $post_id, $meta, false ); $i = 0; $count = count( $ids ); if ( isset( $ids ) && $ids && is_array( $ids ) ): foreach ( $ids as $id ): if ( !$id ) continue; if ( !empty( $before ) ): if ( is_array( $before ) && array_key_exists( $i, $before ) ) echo $before[ $i ] . ' - '; else echo $before; endif; $parents = get_post_ancestors( $id ); $parents = array_combine( array_keys( $parents ), array_reverse( array_values( $parents ) ) ); foreach ( $parents as $parent ): if ( !in_array( $parent, $ids ) ) edit_post_link( get_the_title( $parent ), '', '', $parent ); echo $delimiter; endforeach; edit_post_link( get_the_title( $id ), '', '', $id ); if ( !empty( $after ) ): if ( is_array( $after ) && array_key_exists( $i, $after ) ) echo ' - ' . $after[ $i ]; else echo $after; endif; if ( ++$i !== $count ) echo $sep; endforeach; endif; } } if ( !function_exists( 'sp_post_checklist' ) ) { function sp_post_checklist( $post_id = null, $meta = 'post', $display = 'block', $filter = null, $index = null ) { if ( ! isset( $post_id ) ) global $post_id; ?>
', sizeof( $parents ) ); ?>
$values ): if ( !$key ) continue; $is_auto = array_key_exists( 'auto', $values ) ? (int)$values[ 'auto' ] : 0; ?> >
/> />
/> />

+ labels->singular_name ); ?>