Version Description
Download this release
Release Info
Developer | planetmike |
Plugin | Ultimate Category Excluder |
Version | 0.90 |
Comparing to | |
See all releases |
Code changes from version 0.8 to 0.90
- readme.txt +8 -2
- ultimate-category-excluder.php +148 -133
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: planetmike
|
|
3 |
Donate link: http://www.planetmike.com/donations/
|
4 |
Tags: category, categories, exclude, visible, hidden, hide, invisible, remove
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 0.
|
8 |
|
9 |
Ultimate Category Excluder allows you to quickly and easily exclude categories from your front page, archives, and feeds.
|
10 |
|
@@ -22,6 +22,12 @@ Ultimate Category Excluder (UCE - unfortunately the same abbreviation as unsolic
|
|
22 |
|
23 |
== Changelog ==
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
= 0.8 =
|
26 |
* July 7, 2011 - Categories that do not have any posts in them will now appear on the list of categories.
|
27 |
|
3 |
Donate link: http://www.planetmike.com/donations/
|
4 |
Tags: category, categories, exclude, visible, hidden, hide, invisible, remove
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 3.6
|
7 |
+
Stable tag: 0.84
|
8 |
|
9 |
Ultimate Category Excluder allows you to quickly and easily exclude categories from your front page, archives, and feeds.
|
10 |
|
22 |
|
23 |
== Changelog ==
|
24 |
|
25 |
+
= 0.84 =
|
26 |
+
* August 3, 2013 - Fixed empty category bug. Again.
|
27 |
+
|
28 |
+
= 0.83 =
|
29 |
+
* August 2, 2013 - Added code to give version info for MySQL, PHP, WP and UCE. UCE also works with WP 3.6.
|
30 |
+
|
31 |
= 0.8 =
|
32 |
* July 7, 2011 - Categories that do not have any posts in them will now appear on the list of categories.
|
33 |
|
ultimate-category-excluder.php
CHANGED
@@ -1,133 +1,148 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Ultimate Category Excluder
|
4 |
-
Plugin URI: http://www.planetmike.com/plugins/ultimate-category-excluder/
|
5 |
-
Description: Easily exclude categories from your front page, feeds, and archives.
|
6 |
-
Author: Michael Clark
|
7 |
-
Version: 0.
|
8 |
-
Author URI: http://www.planetmike.com
|
9 |
-
Text Domain: UCE
|
10 |
-
*/
|
11 |
-
|
12 |
-
add_action('admin_menu', 'ksuce_admin_menu');
|
13 |
-
add_filter('pre_get_posts','ksuce_exclude_categories');
|
14 |
-
|
15 |
-
// Include Ultimate Category Excluder language files
|
16 |
-
load_plugin_textdomain('UCE', false, dirname(plugin_basename(__FILE__)) . '/languages');
|
17 |
-
|
18 |
-
function ksuce_admin_menu() {
|
19 |
-
add_options_page( __('Ultimate Category Excluder Options', 'UCE'), __('Category Exclusion', 'UCE'), 9, basename(__FILE__), 'ksuce_options_page');
|
20 |
-
}
|
21 |
-
|
22 |
-
function ksuce_options_page() {
|
23 |
-
if( $_POST[ 'ksuce' ] ) {
|
24 |
-
$message = ksuce_process();
|
25 |
-
}
|
26 |
-
$options = ksuce_get_options();
|
27 |
-
?>
|
28 |
-
<div class="wrap">
|
29 |
-
<h2><?php _e('Ultimate Category Excluder Options', 'UCE'); ?></h2>
|
30 |
-
<?php echo $message ?>
|
31 |
-
<p><?php _e('Use this page to select the categories you wish to exclude and where you would like to exclude them from.', 'UCE'); ?></p>
|
32 |
-
<form action="options-general.php?page=ultimate-category-excluder.php" method="post">
|
33 |
-
<table class="widefat">
|
34 |
-
<thead>
|
35 |
-
<tr>
|
36 |
-
<th scope="col"><?php _e('Category', 'UCE'); ?></th>
|
37 |
-
<th scope="col"><?php _e('Exclude from Main Page?', 'UCE'); ?></th>
|
38 |
-
<th scope="col"><?php _e('Exclude from Feeds?', 'UCE'); ?></th>
|
39 |
-
<th scope="col"><?php _e('Exclude from Archives?', 'UCE'); ?></th>
|
40 |
-
</tr>
|
41 |
-
</thead>
|
42 |
-
<tbody id="the-list">
|
43 |
-
<?php
|
44 |
-
//print_r( get_categories() );
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
<
|
55 |
-
<td
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
</
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Ultimate Category Excluder
|
4 |
+
Plugin URI: http://www.planetmike.com/plugins/ultimate-category-excluder/
|
5 |
+
Description: Easily exclude categories from your front page, feeds, and archives.
|
6 |
+
Author: Michael Clark
|
7 |
+
Version: 0.84
|
8 |
+
Author URI: http://www.planetmike.com
|
9 |
+
Text Domain: UCE
|
10 |
+
*/
|
11 |
+
|
12 |
+
add_action('admin_menu', 'ksuce_admin_menu');
|
13 |
+
add_filter('pre_get_posts','ksuce_exclude_categories');
|
14 |
+
|
15 |
+
// Include Ultimate Category Excluder language files
|
16 |
+
load_plugin_textdomain('UCE', false, dirname(plugin_basename(__FILE__)) . '/languages');
|
17 |
+
|
18 |
+
function ksuce_admin_menu() {
|
19 |
+
add_options_page( __('Ultimate Category Excluder Options', 'UCE'), __('Category Exclusion', 'UCE'), 9, basename(__FILE__), 'ksuce_options_page');
|
20 |
+
}
|
21 |
+
|
22 |
+
function ksuce_options_page() {
|
23 |
+
if( $_POST[ 'ksuce' ] ) {
|
24 |
+
$message = ksuce_process();
|
25 |
+
}
|
26 |
+
$options = ksuce_get_options();
|
27 |
+
?>
|
28 |
+
<div class="wrap">
|
29 |
+
<h2><?php _e('Ultimate Category Excluder Options', 'UCE'); ?></h2>
|
30 |
+
<?php echo $message ?>
|
31 |
+
<p><?php _e('Use this page to select the categories you wish to exclude and where you would like to exclude them from.', 'UCE'); ?></p>
|
32 |
+
<form action="options-general.php?page=ultimate-category-excluder.php" method="post">
|
33 |
+
<table class="widefat">
|
34 |
+
<thead>
|
35 |
+
<tr>
|
36 |
+
<th scope="col"><?php _e('Category', 'UCE'); ?></th>
|
37 |
+
<th scope="col"><?php _e('Exclude from Main Page?', 'UCE'); ?></th>
|
38 |
+
<th scope="col"><?php _e('Exclude from Feeds?', 'UCE'); ?></th>
|
39 |
+
<th scope="col"><?php _e('Exclude from Archives?', 'UCE'); ?></th>
|
40 |
+
</tr>
|
41 |
+
</thead>
|
42 |
+
<tbody id="the-list">
|
43 |
+
<?php
|
44 |
+
//print_r( get_categories() );
|
45 |
+
$args=array(
|
46 |
+
'hide_empty' => 0,
|
47 |
+
'order' => 'ASC'
|
48 |
+
);
|
49 |
+
$cats = get_categories($args);
|
50 |
+
$alt = 0;
|
51 |
+
foreach( $cats as $cat ) {
|
52 |
+
?>
|
53 |
+
<tr<?php if ( $alt == 1 ) { echo ' class="alternate"'; $alt = 0; } else { $alt = 1; } ?>>
|
54 |
+
<th scope="row"><?php echo $cat->cat_name; //. ' (' . $cat->cat_ID . ')'; ?></th>
|
55 |
+
<td>
|
56 |
+
<input type="checkbox" name="exclude_main[]" value="-<?php echo $cat->cat_ID ?>" <?php if ( in_array( '-' . $cat->cat_ID, $options['exclude_main'] ) ) { echo 'checked="true" '; } ?>/>
|
57 |
+
</td>
|
58 |
+
<td><input type="checkbox" name="exclude_feed[]" value="-<?php echo $cat->cat_ID ?>" <?php if ( in_array( '-' . $cat->cat_ID, $options['exclude_feed'] ) ) { echo 'checked="true" '; } ?>/></td>
|
59 |
+
<td><input type="checkbox" name="exclude_archives[]" value="-<?php echo $cat->cat_ID ?>" <?php if ( in_array( '-' . $cat->cat_ID, $options['exclude_archives'] ) ) { echo 'checked="true" '; } ?>/></td>
|
60 |
+
</tr>
|
61 |
+
<?php
|
62 |
+
}
|
63 |
+
?>
|
64 |
+
</table>
|
65 |
+
<p class="submit"><input type="submit" value="<?php _e('Update', 'UCE'); ?>" /></p>
|
66 |
+
<input type="hidden" name="ksuce" value="true" />
|
67 |
+
</form>
|
68 |
+
</div>
|
69 |
+
|
70 |
+
<?php
|
71 |
+
global $wpdb, $wp_version;
|
72 |
+
echo "<h3>Support</h3>\n";
|
73 |
+
echo "<p>Please report this information if you have trouble with this plugin. Thanks!</p>";
|
74 |
+
echo '<ul><li>UCE version: 0.83</li>';
|
75 |
+
echo '<li>PHP version: '.PHP_VERSION.'</li>';
|
76 |
+
echo '<li>MySQL version: '.mysql_get_server_info($wpdb->dbh).'</li>';
|
77 |
+
echo '<li>WordPress version: '.$wp_version.'</li>';
|
78 |
+
if ( AUTH_KEY2 == "" ) {echo "<li>Auth_Key is empty.</li>";} ;
|
79 |
+
echo "</ul>";
|
80 |
+
?>
|
81 |
+
<?php
|
82 |
+
}
|
83 |
+
|
84 |
+
function ksuce_process() {
|
85 |
+
//echo '<pre>'; print_r( $_POST );
|
86 |
+
if( !$_POST[ 'exclude_main' ] ) {
|
87 |
+
$_POST[ 'exclude_main' ] = array();
|
88 |
+
}
|
89 |
+
if( !$_POST[ 'exclude_feed' ] ) {
|
90 |
+
$_POST[ 'exclude_feed' ] = array();
|
91 |
+
}
|
92 |
+
if( !$_POST[ 'exclude_archives' ] ) {
|
93 |
+
$_POST[ 'exclude_archives' ] = array();
|
94 |
+
}
|
95 |
+
$options['exclude_main'] = $_POST[ 'exclude_main' ];
|
96 |
+
$options['exclude_feed'] = $_POST[ 'exclude_feed' ];
|
97 |
+
$options['exclude_archives'] = $_POST[ 'exclude_archives' ];
|
98 |
+
update_option('ksuceExcludes', $options);
|
99 |
+
|
100 |
+
$message = "<div class='updated'><p>" . (__('Excludes successfully updated', 'UCE')) . "</p></div>";
|
101 |
+
return $message;
|
102 |
+
}
|
103 |
+
|
104 |
+
function ksuce_get_options(){
|
105 |
+
$defaults = array();
|
106 |
+
$defaults['exclude_main'] = array();
|
107 |
+
$defaults['exclude_feed'] = array();
|
108 |
+
$defaults['exclude_archives'] = array();
|
109 |
+
|
110 |
+
$options = get_option('ksuceExcludes');
|
111 |
+
if (!is_array($options)){
|
112 |
+
$options = $defaults;
|
113 |
+
update_option('ksuceExcludes', $options);
|
114 |
+
}
|
115 |
+
|
116 |
+
return $options;
|
117 |
+
}
|
118 |
+
|
119 |
+
function ksuce_exclude_categories($query) {
|
120 |
+
$options = ksuce_get_options();
|
121 |
+
if ($query->is_home) {
|
122 |
+
$mbccount=0;
|
123 |
+
foreach ($options[ 'exclude_main' ] as $value) {
|
124 |
+
$array2[$mbccount] = $value;
|
125 |
+
$mbccount++;
|
126 |
+
}
|
127 |
+
$query->set('category__not_in', $array2);
|
128 |
+
}
|
129 |
+
if ($query->is_feed) {
|
130 |
+
$mbccount=0;
|
131 |
+
foreach ($options[ 'exclude_feed' ] as $value) {
|
132 |
+
$array2[$mbccount] = $value;
|
133 |
+
$mbccount++;
|
134 |
+
}
|
135 |
+
$query->set('category__not_in', $array2);
|
136 |
+
}
|
137 |
+
if ($query->is_archive) {
|
138 |
+
$mbccount=0;
|
139 |
+
foreach ($options[ 'exclude_archives' ] as $value) {
|
140 |
+
$array2[$mbccount] = $value;
|
141 |
+
$mbccount++;
|
142 |
+
}
|
143 |
+
$query->set('category__not_in', $array2);
|
144 |
+
}
|
145 |
+
|
146 |
+
return $query;
|
147 |
+
}
|
148 |
+
?>
|