/** * wp_serieslist_display() - Will output a formatted list of all series * Does not have to be in the loop. Is used in the default template for the series table of contents page. * * @package Organize Series WordPress Plugin * @since 2.0 * * @uses get_series() - gets all the series data from the blog (but won't grab empty series). * @uses wp_serieslist_display_code() - assembles the formatted list of series. * * @param bool|string $referral If not set defaults to false. Currently there isn't application for this param but I've left it in for future versions of orgSeries. * @param array ($args) This is so you can indicate various paramaters for what series you want displayed (see get_series for the description of the possible args). */ function wp_serieslist_display($referral = false, $args = '') { global $orgseries; $options = is_object($orgseries) ? $orgseries->settings : null; $per_page = is_array($options) && isset($options['series_perp_toc']) ? $options['series_perp_toc'] : 5; $page = get_query_var('paged') ? get_query_var('paged') : 1; $offset = ($page - 1) * $per_page; $defaults = array('number' => $per_page, 'offset' => $offset, 'hide_empty' => 1); $args = wp_parse_args($args, $defaults); $series_list = get_series($args); foreach ($series_list as $series) { wp_serieslist_display_code($series, $referral); //layout code } }
function series_issue_manager_admin() { $published = get_option('im_published_series'); $unpublished = get_option('im_unpublished_series'); $series = get_series('orderby=name&hide_empty=0'); // Make sure the options exist if ($published === FALSE) { $published = array(); update_option('im_published_series', $published); } if ($unpublished === FALSE) { $unpublished = array(); update_option('im_unpublished_series', $unpublished); } // See if we have GET parameters $series_ID = isset($_GET['series_ID']) ? $_GET['series_ID'] : null; $action = isset($_GET['action']) ? $_GET['action'] : null; if ($series_ID) { $series_ID = (int) $series_ID; switch ($action) { case "list": include_once 'series_im_article_list.php'; break; case "publish": $post_IDs = isset($_GET['posts']) ? $_GET['posts'] : null; $pub_time['mm'] = isset($_GET['mm']) ? $_GET['mm'] : null; $pub_time['jj'] = isset($_GET['jj']) ? $_GET['jj'] : null; $pub_time['aa'] = isset($_GET['aa']) ? $_GET['aa'] : null; $pub_time['hh'] = isset($_GET['hh']) ? $_GET['hh'] : null; $pub_time['mn'] = isset($_GET['mn']) ? $_GET['mn'] : null; if ($post_IDs) { series_issue_manager_publish($series_ID, $post_IDs, $pub_time, $published, $unpublished); } include_once 'series_im_admin_main.php'; break; case "unpublish": series_issue_manager_unpublish($series_ID, $published, $unpublished); include_once 'series_im_admin_main.php'; break; case "ignore": // stop tracking the series_ID $key = array_search($series_ID, $published); if (FALSE !== $key) { array_splice($published, $key, 1); update_option('im_published_series', $published); } $key = array_search($series_ID, $unpublished); if (FALSE !== $key) { array_splice($unpublished, $key, 1); update_option('im_unpublished_series', $unpublished); } include_once 'series_im_admin_main.php'; break; default: include_once 'series_im_admin_main.php'; break; } } else { include_once 'series_im_admin_main.php'; } }
<?php $series = get_series("orderby=name&hide_empty=0&include={$series_ID}"); $posts = get_objects_in_term($series_ID, 'series'); $post_IDs = array(); if ($posts) { foreach ($posts as $post) { $post_IDs[] = $post; } } else { $post_IDs[] = 0; } /*// take the series out of the unpublished list $unpublished_series = $unpublished; $key = array_search( $series_ID, $unpublished_series ); if ( FALSE !== $key ) { array_splice( $unpublished_series, $key, 1 ); }*/ query_posts(array("post__in" => $post_IDs, "posts_per_page" => -1, "post_status" => 'pending')); ?> <div class="wrap"> <?php if (have_posts() && isset($series[0])) { ?> <h2><?php _e('Publishing Series:', 'organize-series-publisher'); echo $series[0]->name; ?> </h2> <div id="poststuff" class="metabox-holder has-right-sidebar"> <div id="side-info-column" class="inner-sidebar">
/** * get_series_list() - queries the list of series from the database and creates an array indicating what * series is associated with the current post (if existent). * * The code here is mirrored from get_nested_categories in the core wp-admin\includes\template.php * file. * * @uses count() - internal WordPress function * @uses wp_get_post_series() * @uses get_series() * @uses get_the_series_by_ID() * @uses apply_filters() - user can modify the array that is returned. * @param int $default - id for the default series. Currently there is not an option for users to set a * default series. This may change in the future. * @return array|mixed $result - series ids, series names, and checked value. */ function get_series_list($default = 0) { global $post, $postdata, $checked_series; $post_ID = isset($post) ? $post->ID : $postdata->ID; if (empty($checked_series)) { if ($post_ID) { $checked_series = wp_get_post_series($post_ID); if (count($checked_series) == 0) { $checked_series[] = $default; } } else { $checked_series[] = $default; } $series = get_series("hide_empty=0&fields=ids"); $result = array(); if (is_array($series)) { foreach ($series as $serial) { $result[$serial]['series_ID'] = $serial; $result[$serial]['checked'] = in_array($serial, $checked_series); $result[$serial]['ser_name'] = get_the_series_by_ID($serial); } } $result = apply_filters('get_series_list', $result); usort($result, '_usort_series_by_name'); return $result; } }