Version Description
- Added 'before more tag' column, which will show the content which is placed before the more-tag
- bug fix: file images will now also be displayed when they can not be resized.
- bug fix: the checkbox disappeared when resetting columns and resaving them.
Download this release
Release Info
Developer | codepress |
Plugin | Admin Columns |
Version | 1.4.6.4 |
Comparing to | |
See all releases |
Code changes from version 1.4.6.3 to 1.4.6.4
- classes/sortable.php +9 -0
- classes/utility.php +5 -3
- classes/values.php +24 -3
- classes/values/posts.php +10 -0
- codepress-admin-columns.php +30 -21
- readme.txt +11 -5
classes/sortable.php
CHANGED
@@ -894,6 +894,15 @@ class Codepress_Sortable_Columns extends Codepress_Admin_Columns
|
|
894 |
}
|
895 |
}
|
896 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
897 |
|
898 |
/** native WP columns */
|
899 |
|
894 |
}
|
895 |
}
|
896 |
break;
|
897 |
+
|
898 |
+
case 'column-before-moretag' :
|
899 |
+
$sort_flag = SORT_STRING;
|
900 |
+
foreach ( $this->get_any_posts_by_posttype($post_type) as $p ) {
|
901 |
+
$extended = get_extended($p->post_content);
|
902 |
+
$content = !empty($extended['extended']) ? $extended['main'] : '';
|
903 |
+
$cposts[$p->ID] = $this->prepare_sort_string_value($content);
|
904 |
+
}
|
905 |
+
break;
|
906 |
|
907 |
/** native WP columns */
|
908 |
|
classes/utility.php
CHANGED
@@ -12,10 +12,12 @@
|
|
12 |
function pre_load_wordpress_seo_class_metabox()
|
13 |
{
|
14 |
global $pagenow;
|
15 |
-
|
16 |
if (
|
17 |
-
isset($_REQUEST['page']) &&
|
18 |
-
'
|
|
|
|
|
19 |
file_exists(WPSEO_PATH.'admin/class-metabox.php')
|
20 |
) {
|
21 |
require_once WPSEO_PATH.'admin/class-metabox.php';
|
12 |
function pre_load_wordpress_seo_class_metabox()
|
13 |
{
|
14 |
global $pagenow;
|
15 |
+
|
16 |
if (
|
17 |
+
isset($_REQUEST['page']) &&
|
18 |
+
'codepress-admin-columns' == $_REQUEST['page'] &&
|
19 |
+
'options-general.php' == $pagenow &&
|
20 |
+
defined('WPSEO_PATH') &&
|
21 |
file_exists(WPSEO_PATH.'admin/class-metabox.php')
|
22 |
) {
|
23 |
require_once WPSEO_PATH.'admin/class-metabox.php';
|
classes/values.php
CHANGED
@@ -139,20 +139,41 @@ class CPAC_Values
|
|
139 |
if ( empty($image) )
|
140 |
return false;
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
// get correct image path
|
143 |
$image_path = str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $image);
|
144 |
|
145 |
// resize image
|
146 |
if ( file_exists($image_path) && $this->is_image($image_path) ) {
|
147 |
-
$resized = image_resize( $image_path,
|
148 |
|
|
|
149 |
if ( ! is_wp_error( $resized ) ) {
|
150 |
$image = str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, $resized);
|
151 |
|
152 |
-
return "<img src='{$image}' alt='' width='
|
153 |
}
|
154 |
|
155 |
-
return
|
|
|
|
|
|
|
156 |
}
|
157 |
|
158 |
return false;
|
139 |
if ( empty($image) )
|
140 |
return false;
|
141 |
|
142 |
+
// get thumbnail image size
|
143 |
+
$image_size = $this->thumbnail_size; // w, h
|
144 |
+
|
145 |
+
// incase the thumbnail dimension is set by name
|
146 |
+
if ( !is_array($image_size) ) {
|
147 |
+
global $_wp_additional_image_sizes;
|
148 |
+
if ( isset($_wp_additional_image_sizes[$image_size]) ) {
|
149 |
+
$_size = $_wp_additional_image_sizes[$image_size];
|
150 |
+
$image_size = array( $_size['width'], $_size['height'] );
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
// fallback for image size incase the passed size name does not exists
|
155 |
+
if ( !isset($image_size[0]) || !isset($image_size[1]) ) {
|
156 |
+
$image_size = array(80, 80);
|
157 |
+
}
|
158 |
+
|
159 |
// get correct image path
|
160 |
$image_path = str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $image);
|
161 |
|
162 |
// resize image
|
163 |
if ( file_exists($image_path) && $this->is_image($image_path) ) {
|
164 |
+
$resized = image_resize( $image_path, $image_size[0], $image_size[1], true);
|
165 |
|
166 |
+
// resize worked
|
167 |
if ( ! is_wp_error( $resized ) ) {
|
168 |
$image = str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, $resized);
|
169 |
|
170 |
+
return "<img src='{$image}' alt='' width='{$image_size[0]}' height='{$image_size[1]}' />";
|
171 |
}
|
172 |
|
173 |
+
// resizing failed so let's return full image with maxed dimensions
|
174 |
+
else {
|
175 |
+
return "<img src='{$image}' alt='' style='max-width:{$image_size[0]}px;max-height:{$image_size[1]}px' />";
|
176 |
+
}
|
177 |
}
|
178 |
|
179 |
return false;
|
classes/values/posts.php
CHANGED
@@ -190,6 +190,16 @@ class CPAC_Posts_Values extends CPAC_Values
|
|
190 |
$result = $this->get_column_value_authorname($post_id, $column_name);
|
191 |
break;
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
default :
|
194 |
$result = '';
|
195 |
|
190 |
$result = $this->get_column_value_authorname($post_id, $column_name);
|
191 |
break;
|
192 |
|
193 |
+
// Before More Tag
|
194 |
+
case "column-before-moretag" :
|
195 |
+
$p = get_post($post_id);
|
196 |
+
$extended = get_extended($p->post_content);
|
197 |
+
|
198 |
+
if ( !empty($extended['extended']) ) {
|
199 |
+
$result = $this->get_shortened_string($extended['main'], $this->excerpt_length );
|
200 |
+
}
|
201 |
+
break;
|
202 |
+
|
203 |
default :
|
204 |
$result = '';
|
205 |
|
codepress-admin-columns.php
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
<?php
|
2 |
/*
|
|
|
3 |
Plugin Name: Codepress Admin Columns
|
4 |
-
Version: 1.4.6.
|
5 |
Description: Customise columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
|
6 |
Author: Codepress
|
7 |
Author URI: http://www.codepress.nl
|
@@ -26,7 +27,7 @@ along with this program; if not, write to the Free Software
|
|
26 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
29 |
-
define( 'CPAC_VERSION', '1.4.6.
|
30 |
define( 'CPAC_TEXTDOMAIN', 'codepress-admin-columns' );
|
31 |
define( 'CPAC_SLUG', 'codepress-admin-columns' );
|
32 |
define( 'CPAC_URL', plugins_url('', __FILE__) );
|
@@ -965,9 +966,7 @@ class Codepress_Admin_Columns
|
|
965 |
* @since 1.0
|
966 |
*/
|
967 |
private function get_wp_default_posts_columns($post_type = 'post')
|
968 |
-
{
|
969 |
-
global $current_screen;
|
970 |
-
|
971 |
// some plugins depend on settings the $_GET['post_type'] variable such as ALL in One SEO
|
972 |
$_GET['post_type'] = $post_type;
|
973 |
|
@@ -978,8 +977,8 @@ class Codepress_Admin_Columns
|
|
978 |
// some plugins directly hook into get_column_headers, such as woocommerce
|
979 |
$columns = get_column_headers( 'edit-'.$post_type );
|
980 |
|
981 |
-
// get default columns
|
982 |
-
if ( empty($columns)
|
983 |
|
984 |
// deprecated as of wp3.3
|
985 |
if ( file_exists(ABSPATH . 'wp-admin/includes/template.php') )
|
@@ -997,8 +996,13 @@ class Codepress_Admin_Columns
|
|
997 |
|
998 |
// we need to change the current screen
|
999 |
global $current_screen;
|
|
|
|
|
1000 |
$org_current_screen = $current_screen;
|
1001 |
-
|
|
|
|
|
|
|
1002 |
// overwrite current_screen global with our post type of choose...
|
1003 |
$current_screen->post_type = $post_type;
|
1004 |
|
@@ -1007,6 +1011,7 @@ class Codepress_Admin_Columns
|
|
1007 |
|
1008 |
// reset current screen
|
1009 |
$current_screen = $org_current_screen;
|
|
|
1010 |
}
|
1011 |
|
1012 |
if ( empty ( $columns ) )
|
@@ -1086,21 +1091,21 @@ class Codepress_Admin_Columns
|
|
1086 |
* @since 1.2.1
|
1087 |
*/
|
1088 |
private function get_wp_default_media_columns()
|
1089 |
-
{
|
1090 |
-
global $current_screen;
|
1091 |
-
|
1092 |
// @todo could use _get_list_table('WP_Media_List_Table') ?
|
1093 |
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php') )
|
1094 |
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1095 |
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php') )
|
1096 |
require_once(ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php');
|
1097 |
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
// save original
|
1102 |
$org_current_screen = $current_screen;
|
1103 |
|
|
|
|
|
|
|
1104 |
// overwrite current_screen global with our media id...
|
1105 |
$current_screen->id = 'upload';
|
1106 |
|
@@ -1162,20 +1167,21 @@ class Codepress_Admin_Columns
|
|
1162 |
* @since 1.3.1
|
1163 |
*/
|
1164 |
private function get_wp_default_comments_columns()
|
1165 |
-
{
|
1166 |
-
global $current_screen;
|
1167 |
-
|
1168 |
// dependencies
|
1169 |
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php') )
|
1170 |
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1171 |
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-comments-list-table.php') )
|
1172 |
require_once(ABSPATH . 'wp-admin/includes/class-wp-comments-list-table.php');
|
1173 |
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
$org_current_screen = $current_screen;
|
1178 |
|
|
|
|
|
|
|
1179 |
// overwrite current_screen global with our media id...
|
1180 |
$current_screen->id = 'edit-comments';
|
1181 |
|
@@ -1311,6 +1317,9 @@ class Codepress_Admin_Columns
|
|
1311 |
'column-author-name' => array(
|
1312 |
'label' => __('Display Author As', CPAC_TEXTDOMAIN),
|
1313 |
'display_as' => ''
|
|
|
|
|
|
|
1314 |
)
|
1315 |
);
|
1316 |
|
@@ -2015,7 +2024,7 @@ class Codepress_Admin_Columns
|
|
2015 |
function admin_class()
|
2016 |
{
|
2017 |
global $current_screen;
|
2018 |
-
|
2019 |
// we dont need the 'edit-' part
|
2020 |
$screen = str_replace('edit-', '', $current_screen->id);
|
2021 |
|
1 |
<?php
|
2 |
/*
|
3 |
+
|
4 |
Plugin Name: Codepress Admin Columns
|
5 |
+
Version: 1.4.6.4
|
6 |
Description: Customise columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
|
7 |
Author: Codepress
|
8 |
Author URI: http://www.codepress.nl
|
27 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
28 |
*/
|
29 |
|
30 |
+
define( 'CPAC_VERSION', '1.4.6.4' );
|
31 |
define( 'CPAC_TEXTDOMAIN', 'codepress-admin-columns' );
|
32 |
define( 'CPAC_SLUG', 'codepress-admin-columns' );
|
33 |
define( 'CPAC_URL', plugins_url('', __FILE__) );
|
966 |
* @since 1.0
|
967 |
*/
|
968 |
private function get_wp_default_posts_columns($post_type = 'post')
|
969 |
+
{
|
|
|
|
|
970 |
// some plugins depend on settings the $_GET['post_type'] variable such as ALL in One SEO
|
971 |
$_GET['post_type'] = $post_type;
|
972 |
|
977 |
// some plugins directly hook into get_column_headers, such as woocommerce
|
978 |
$columns = get_column_headers( 'edit-'.$post_type );
|
979 |
|
980 |
+
// get default columns
|
981 |
+
if ( empty($columns) ) {
|
982 |
|
983 |
// deprecated as of wp3.3
|
984 |
if ( file_exists(ABSPATH . 'wp-admin/includes/template.php') )
|
996 |
|
997 |
// we need to change the current screen
|
998 |
global $current_screen;
|
999 |
+
|
1000 |
+
// save original
|
1001 |
$org_current_screen = $current_screen;
|
1002 |
+
|
1003 |
+
// prevent php warning
|
1004 |
+
if ( !isset($current_screen) ) $current_screen = new stdClass;
|
1005 |
+
|
1006 |
// overwrite current_screen global with our post type of choose...
|
1007 |
$current_screen->post_type = $post_type;
|
1008 |
|
1011 |
|
1012 |
// reset current screen
|
1013 |
$current_screen = $org_current_screen;
|
1014 |
+
|
1015 |
}
|
1016 |
|
1017 |
if ( empty ( $columns ) )
|
1091 |
* @since 1.2.1
|
1092 |
*/
|
1093 |
private function get_wp_default_media_columns()
|
1094 |
+
{
|
|
|
|
|
1095 |
// @todo could use _get_list_table('WP_Media_List_Table') ?
|
1096 |
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php') )
|
1097 |
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1098 |
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php') )
|
1099 |
require_once(ABSPATH . 'wp-admin/includes/class-wp-media-list-table.php');
|
1100 |
|
1101 |
+
global $current_screen;
|
1102 |
+
|
|
|
1103 |
// save original
|
1104 |
$org_current_screen = $current_screen;
|
1105 |
|
1106 |
+
// prevent php warning
|
1107 |
+
if ( !isset($current_screen) ) $current_screen = new stdClass;
|
1108 |
+
|
1109 |
// overwrite current_screen global with our media id...
|
1110 |
$current_screen->id = 'upload';
|
1111 |
|
1167 |
* @since 1.3.1
|
1168 |
*/
|
1169 |
private function get_wp_default_comments_columns()
|
1170 |
+
{
|
|
|
|
|
1171 |
// dependencies
|
1172 |
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php') )
|
1173 |
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
|
1174 |
if ( file_exists(ABSPATH . 'wp-admin/includes/class-wp-comments-list-table.php') )
|
1175 |
require_once(ABSPATH . 'wp-admin/includes/class-wp-comments-list-table.php');
|
1176 |
|
1177 |
+
global $current_screen;
|
1178 |
+
|
1179 |
+
// save original
|
1180 |
$org_current_screen = $current_screen;
|
1181 |
|
1182 |
+
// prevent php warning
|
1183 |
+
if ( !isset($current_screen) ) $current_screen = new stdClass;
|
1184 |
+
|
1185 |
// overwrite current_screen global with our media id...
|
1186 |
$current_screen->id = 'edit-comments';
|
1187 |
|
1317 |
'column-author-name' => array(
|
1318 |
'label' => __('Display Author As', CPAC_TEXTDOMAIN),
|
1319 |
'display_as' => ''
|
1320 |
+
),
|
1321 |
+
'column-before-moretag' => array(
|
1322 |
+
'label' => __('Before More Tag', CPAC_TEXTDOMAIN)
|
1323 |
)
|
1324 |
);
|
1325 |
|
2024 |
function admin_class()
|
2025 |
{
|
2026 |
global $current_screen;
|
2027 |
+
|
2028 |
// we dont need the 'edit-' part
|
2029 |
$screen = str_replace('edit-', '', $current_screen->id);
|
2030 |
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: codepress, tschutter, davidmosterd
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZDZRSYLQ4Z76J
|
4 |
Tags: plugins, wordpress, admin, column, columns, custom columns, custom fields, image, dashboard, sortable, filters, posts, media, users, pages, posttypes, manage columns, wp-admin
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 3.4
|
7 |
-
Stable tag: 1.4.6.
|
8 |
|
9 |
Customise columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
|
10 |
|
@@ -36,6 +36,7 @@ The following custom columns are added:
|
|
36 |
* Number of Attachments
|
37 |
* Last Modified
|
38 |
* Comment count
|
|
|
39 |
* Custom Fields
|
40 |
|
41 |
= User Columns =
|
@@ -168,7 +169,8 @@ add_filter('cpac_thumbnail_size', function() {
|
|
168 |
?>
|
169 |
`
|
170 |
|
171 |
-
**my
|
|
|
172 |
If you want your already uploaded images to display the newly added size you will need to regenerate the thumbnail for them. Use this plugin to generate the newly added sized thumbnails: http://wordpress.org/extend/plugins/regenerate-thumbnails/.
|
173 |
|
174 |
= How can I enable the use of Hidden Custom Fields? =
|
@@ -201,7 +203,7 @@ With this filter 'cpac_get_column_value_custom_field' you can control what the v
|
|
201 |
|
202 |
Filter explained:
|
203 |
|
204 |
-
* **$value** is the
|
205 |
* **$internal_field_key** is only used internally to store the column
|
206 |
* **$custom_field** is the name of your custom field
|
207 |
* **$type** will return either the posttype or if it is any other type it will return wp-comments, wp-links, wp-users, wp-media.
|
@@ -231,7 +233,6 @@ add_filter( 'cpac_get_column_value_custom_field', 'my_custom_field_value', 10, 5
|
|
231 |
?>
|
232 |
`
|
233 |
|
234 |
-
|
235 |
== Screenshots ==
|
236 |
|
237 |
1. Settings page for Post(type) columns.
|
@@ -244,6 +245,11 @@ add_filter( 'cpac_get_column_value_custom_field', 'my_custom_field_value', 10, 5
|
|
244 |
|
245 |
== Changelog ==
|
246 |
|
|
|
|
|
|
|
|
|
|
|
247 |
= 1.4.6.3 =
|
248 |
|
249 |
* Added new custom field type: User by User ID
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZDZRSYLQ4Z76J
|
4 |
Tags: plugins, wordpress, admin, column, columns, custom columns, custom fields, image, dashboard, sortable, filters, posts, media, users, pages, posttypes, manage columns, wp-admin
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 3.4.2
|
7 |
+
Stable tag: 1.4.6.4
|
8 |
|
9 |
Customise columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
|
10 |
|
36 |
* Number of Attachments
|
37 |
* Last Modified
|
38 |
* Comment count
|
39 |
+
* Before More Tag Content
|
40 |
* Custom Fields
|
41 |
|
42 |
= User Columns =
|
169 |
?>
|
170 |
`
|
171 |
|
172 |
+
**my columns thumbnails still have the wrong size**
|
173 |
+
|
174 |
If you want your already uploaded images to display the newly added size you will need to regenerate the thumbnail for them. Use this plugin to generate the newly added sized thumbnails: http://wordpress.org/extend/plugins/regenerate-thumbnails/.
|
175 |
|
176 |
= How can I enable the use of Hidden Custom Fields? =
|
203 |
|
204 |
Filter explained:
|
205 |
|
206 |
+
* **$value** is the original value which would otherwise be displayed
|
207 |
* **$internal_field_key** is only used internally to store the column
|
208 |
* **$custom_field** is the name of your custom field
|
209 |
* **$type** will return either the posttype or if it is any other type it will return wp-comments, wp-links, wp-users, wp-media.
|
233 |
?>
|
234 |
`
|
235 |
|
|
|
236 |
== Screenshots ==
|
237 |
|
238 |
1. Settings page for Post(type) columns.
|
245 |
|
246 |
== Changelog ==
|
247 |
|
248 |
+
= 1.4.6.4 =
|
249 |
+
* Added 'before more tag' column, which will show the content which is placed before the more-tag
|
250 |
+
* bug fix: file images will now also be displayed when they can not be resized.
|
251 |
+
* bug fix: the checkbox disappeared when resetting columns and resaving them.
|
252 |
+
|
253 |
= 1.4.6.3 =
|
254 |
|
255 |
* Added new custom field type: User by User ID
|