"post_title", "drp_posts_default" => "title", "chk_default_options_db" => "0", "rdo_display_order" => "pages_left"); update_option('wpss_options', $arr); } } // Init plugin options to white list our options function wpss_init(){ // this is primarily to check newly added options have correct initial values $tmp = get_option('wpss_options'); if(!$tmp['rdo_display_order']) // check radio buttons have a starting value { $tmp["rdo_display_order"] = "pages_left"; update_option('wpss_options', $tmp); } register_setting( 'wpss_plugin_options', 'wpss_options', 'wpss_validate_options' ); } // Add menu page function wpss_add_options_page() { add_options_page('Simple Sitemap Options Page', 'Simple Sitemap', 'manage_options', __FILE__, 'wpss_render_form'); } // Draw the menu page itself function wpss_render_form() { ?>

Simple Sitemap Options

To display the Simple Sitemap on a post/page, enter the following shortcode: [simple-sitemap]
Configure the plugin options below. If you like this Plugin, or use it on a commercial website, then please consider making a donation to support continued development of this Plugin.
Content Display Order

Pages Drop-Down Default
Posts Drop-Down Default
Database Options
Only check this if you want to reset plugin settings upon reactivation

*New* Plugin Support Forum!(click to expand)

Follow me on twitter. Also, check out our new site: PressCoders.com

query_vars['pagesort'])) { return $wp_query->query_vars['pagesort']; } } function post_params() { global $wp_query; if (isset($wp_query->query_vars['postsort'])) { return $wp_query->query_vars['postsort']; } } // shortcode function function wpss_gen() { ob_start(); // start output caching (so that existing content in the [simple-sitemap] post doesn't get shoved to the bottom of the post global $post; //wordpress post global object $permalink_structure = get_option( 'permalink_structure' ); if($permalink_structure == null) { $link_url = get_permalink($post->ID); $query_symbol = '&'; // add a '&' character prefix onto the query string } else if((substr($permalink_structure, -1)) != '/') { $link_url = get_permalink($post->ID).'/'; $query_symbol = '?'; // add a '?' character prefix onto the query string } else { $link_url = get_permalink($post->ID); $query_symbol = '?'; // add a '?' character prefix onto the query string } // sort by value in drop down box (make sure drop down default is title which is the default used by wp_list_pages) $page_params = page_params(); $post_params = post_params(); $opt = get_option('wpss_options'); //echo '$opt[\'drp_pages_default\'] = '.$opt['drp_pages_default'].'
'; //echo '$opt[\'drp_posts_default\'] = '.$opt['drp_posts_default'].'
'; if($page_params == null ) { if($opt['drp_pages_default'] == "post_title") { $page_params = 'menu_order, post_title'; } else if ($opt['drp_pages_default'] == "post_date") { $page_params = 'post_date'; } else { $page_params = 'post_author'; } } $page_args=array( 'sort_column' => $page_params, 'title_li' => ''); if($post_params == null ) { if($opt['drp_posts_default'] == "title") { $post_params = 'title'; } else if ($opt['drp_posts_default'] == "date") { $post_params = 'date'; } else if ($opt['drp_posts_default'] == "author") { $post_params = 'author'; } else if ($opt['drp_posts_default'] == "category") { $post_params = 'category'; } else { $post_params = 'tags'; } } $post_args=array( 'orderby' => $post_params, 'posts_per_page' => -1, 'order' => 'asc' ); //echo "
Page Args:
"; //print_r($page_args); //echo "

Posts Args:
"; //print_r($post_args); //echo "

Page Params: $page_params"; //echo "
Post Params: $post_params"; // Initialise to "" to prevent undefined variable error $pt1=$pd1=$pa1=$pt2=$pd2=$pa2=$pc2=$ptg2=""; // page drop down box if($page_params == 'menu_order, post_title') { $pt1 = "selected='selected'"; } else if($page_params == 'post_date') { $pd1 = "selected='selected'"; } else if($page_params == 'post_author') { $pa1 = "selected='selected'"; } // post drop down box if($post_params == 'title') { $pt2 = "selected='selected'"; } else if($post_params == 'date') { $pd2 = "selected='selected'"; } else if($post_params == 'author') { $pa2 = "selected='selected'"; } else if($post_params == 'category') { $pc2 = "selected='selected'"; } else if($post_params == 'tags') { $ptg2 = "selected='selected'"; } ?>

Pages

'; $page_args=array('sort_order' => 'desc', 'sort_column' => 'post_date', 'date_format' => ' (m.d.y)', 'show_date'=> 'created', 'title_li' => ''); wp_list_pages($page_args); // show the sorted pages echo ''; } elseif(strpos($page_params, 'post_author') !== false) { $authors = get_users_of_blog(); //gets registered users foreach ($authors as $author) { $empty_page_args=array('echo' => 0, 'authors' => $author->user_id, 'title_li' => ''); $empty_test = wp_list_pages($empty_page_args); // test for authors with zero pages //echo '$empty_test = '.$empty_test; if($empty_test != null || $empty_test != "") { echo "
$author->display_name
"; echo "
    "; $page_args=array('authors' => $author->user_id, 'title_li' => ''); wp_list_pages($page_args); echo "
"; } else { echo "
$author->display_name (no pages published)
"; } } ?> '; wp_list_pages($page_args); // show the sorted pages echo ''; } ?>

Posts

Show posts by:
term_id); $cat_count = $category->category_count; echo '
'.ucwords($category->cat_name).' '; query_posts('post_status=publish&cat='.$category->term_id); // show the sorted posts ?> post_count.')
'; ?>
'; endif; wp_reset_query(); } } else if(strpos($post_params, 'author') !== false) { $authors = get_users_of_blog(); //gets registered users foreach ($authors as $author) { echo ''.$author->display_name.' '; query_posts('post_status=publish&author='.$author->user_id); // show the sorted posts ?> post_count.')'; ?>
'; endif; wp_reset_query(); } } else if(strpos($post_params, 'tags') !== false) { $post_tags = get_tags(); echo '
'; foreach ($post_tags as $tag){ $tag_link = get_tag_link($tag->term_id); echo ""; echo "{$tag->name} ($tag->count)"; query_posts('post_status=publish&tag='.$tag->slug); // show posts ?>
'; endif; wp_reset_query(); } echo ''; } else if(strpos($post_params, 'date') !== false) { ?>
get_results("SELECT DISTINCT MONTH(post_date) AS month , YEAR(post_date) AS year FROM $wpdb->posts WHERE post_status = 'publish' and post_date <= now( ) and post_type = 'post' GROUP BY month, year ORDER BY post_date DESC"); foreach($months as $curr_month){ query_posts('post_status=publish&monthnum='.$curr_month->month.'&year='.$curr_month->year); // show posts ?> year, $curr_month->month); echo '">'.date( 'F', mktime(0, 0, 0, $curr_month->month) ).' '.$curr_month->year.' ('.$wp_query->post_count.')'; ?>
'; endif; wp_reset_query(); } ?> '; while (have_posts()) : the_post(); $sticky=""; if(is_sticky(get_the_ID())) { $sticky=" (sticky post)"; } ?>
  • '; endif; wp_reset_query(); } ?>