Closed GoogleCodeExporter closed 8 years ago
Original comment by fireproofsocks
on 26 Mar 2011 at 1:22
Issue 18 has been merged into this issue.
Original comment by fireproofsocks
on 22 Apr 2011 at 3:22
How badly would it kill the manager performance if you enabled custom fields to
be used as columns?
Original comment by fireproofsocks
on 18 Aug 2011 at 6:32
See issue 204.
Original comment by fireproofsocks
on 12 Oct 2011 at 8:03
what about the display options? like i click on them and i will be able to show
column a and b but not c?
i think the tricky part here is dynamic sorting for all of the different types
:/
Original comment by googleac...@vision-network.org
on 17 Oct 2011 at 2:49
Custom sort order has already been implemented: edit your post-type definition,
see the "Advanced" tab.
Original comment by fireproofsocks
on 10 Nov 2011 at 7:41
Issue 242 has been merged into this issue.
Original comment by fireproofsocks
on 28 Nov 2011 at 5:56
just thinking that if this can be done in the thickbox too that'd be enormously
helpful for me.
Original comment by mopto...@gmail.com
on 28 Nov 2011 at 7:10
re: custom sort order (comment 6) is there any chance the sort order could be
set on a custom field? the UI would have to change from a dropdown menu to
something more complex.
Original comment by mopto...@gmail.com
on 28 Nov 2011 at 7:13
Re the thickbox: yes, that's possible... that's just the eye-candy
implementation. Once the functionality is in place, I can display it however I
want.
Re sorting on a custom field: yes, the GetPostsQuery supports that, and I plan
on integrating that into the UI. The dropdown will still work fine: it'll list
all available columns (built-in and "virtual" columns from the custom fields).
Original comment by fireproofsocks
on 28 Nov 2011 at 7:23
This is relevant:
* http://www.fldtrace.com/wordpress/wordpress-custom-post-types-custom-back-end-columns-and-post-thumbnails
* http://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column
* http://codex.wordpress.org/Plugin_API/Filter_Reference/manage_edit-post_type_columns
Original comment by ever...@fireproofsocks.com
on 26 Jan 2012 at 6:00
A draft is now live on the dev branch. Committed revision 496516. This needs
testing and I'll add some configuration options since WP's implementation is
pretty inflexible.
Original comment by ever...@fireproofsocks.com
on 28 Jan 2012 at 3:41
I don't think sorting on the custom fields is easy...
http://codex.wordpress.org/Custom_Queries looks like you have to tie into a
different event to customize the join (i.e. to join on the custom fields), then
alter the query's "group by". Ugh... the architecture here chafes me. See
issue 142
(http://code.google.com/p/wordpress-custom-content-type-manager/issues/detail?id
=142)
Original comment by ever...@fireproofsocks.com
on 30 Jan 2012 at 3:02
Specifically this bit of code to handle the where, join, and group by filters
add_filter('posts_join', 'geotag_search_join' );
add_filter('posts_where', 'geotag_search_where' );
add_filter('posts_groupby', 'geotag_search_groupby' );
function geotag_search_join( $join )
{
global $geotag_table, $wpdb;
if( is_search() ) {
$join .= " LEFT JOIN $geotag_table ON " .
$wpdb->posts . ".ID = " . $geotag_table .
".geotag_post_id ";
}
return $join;
}
function geotag_search_where( $where )
{
if( is_search() ) {
$where = preg_replace(
"/\(\s*post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
"(post_title LIKE $1) OR (geotag_city LIKE $1) OR (geotag_state LIKE $1) OR (geotag_country LIKE $1)", $where );
}
return $where;
}
function geotag_search_groupby( $groupby )
{
global $wpdb;
if( !is_search() ) {
return $groupby;
}
// we need to group on post ID
$mygroupby = "{$wpdb->posts}.ID";
if( preg_match( "/$mygroupby/", $groupby )) {
// grouping we need is already there
return $groupby;
}
if( !strlen(trim($groupby))) {
// groupby was empty, use ours
return $mygroupby;
}
// wasn't empty, append ours
return $groupby . ", " . $mygroupby;
}
Original comment by ever...@fireproofsocks.com
on 3 Feb 2012 at 5:08
Committed revision 501242.
Requires testing.
Original comment by ever...@fireproofsocks.com
on 6 Feb 2012 at 8:14
just updated to newest trunk (took me a while, I was afraid to update to 3.3!),
and for me no data is being displayed in the custom columns. space is made for
the columns themselves, and ordering of columns is working too, but in the
actual rows of the table the fields are left blank. I assume something is going
wrong with the complex queries in CCTM_Columns.php. Can you suggest some
debugging output (e.g., can I print the queries or something)?
Thanks as always,
Matt
Original comment by mopto...@gmail.com
on 9 Feb 2012 at 3:29
Attachments:
I need to document this: the custom columns will rely on the default output
filter, so if your field requires additional formatting beyond what
print_custom_field() would cough up, then it may come back blank. I'm working
on this too -- gotta get it tight and documented before the dev branch can go
public.
If you want to look at some of the code, the magic here happens inside
includes/CCTM_Columns.php, inside the populate_custom_column_data() function.
Could you attach your .cctm.json definition file?
Original comment by ever...@fireproofsocks.com
on 9 Feb 2012 at 5:02
Ack, I think I submitted to SVN before uncommenting some testing code:
inside of includes/CCTM_Columns.php in the populate_custom_column_data()
function, make sure the 2 lines at the top are commented out:
// print_custom_field($column.':formatted_list');
// return;
And then at the tail end of that function, make sure the "formatted_list" bit
is removed:
default:
print_custom_field($column);
Sorry about that. Tests tests tests... marking this as "in progress" until I
finish testing it.
Original comment by ever...@fireproofsocks.com
on 9 Feb 2012 at 7:16
cctm.json attached. tried fixing those comment problems but this still didn't
work for me; I think maybe populate_custom_column_data() isn't getting called,
because I tried putting in some debug lines there (print "hello!";) and still
didn't see any output.
will try to help with this when I have a chance. thanks again,
matt
Original comment by mopto...@gmail.com
on 9 Feb 2012 at 11:41
Attachments:
This should be fixed now on the dev branch. Please confirm.
Committed revision 503040.
Original comment by ever...@fireproofsocks.com
on 10 Feb 2012 at 4:51
updated to current svn, but no luck. I've appended a sample tr element from
the table, where you cna see the empty custom fields. Again, I tried a print
statement near the top of populate_custom_column_data() -- right after global
$post -- to see
if I could get some data to appear, but nothing shows up. Is it worth trying
w/ my cctm.json? but seems odd that the cct defns would make much of a
difference.
thx again,
m
<tr id="post-2393" class="post-2393 people type-people status-publish
format-standard hentry iedit author-other even" valign="top">
<th scope="row" class="check-column"><input type="checkbox" name="post[]" value="2393" /></th>
<td class="name_last column-name_last"></td>
<td class="name_first column-name_first"></td>
<td class="email column-email"></td>
<td class="post-title page-title column-title"><strong><a class="row-title" href="http://department-test-wp.hackinghistory.ca/wp-admin/post.php?post=2393&action=edit" title="Edit “Anderson, Julie”">Anderson, Julie</a></strong>
<div class="row-actions"><span class='edit'><a
href="http://department-test-wp.hackinghistory.ca/wp-admin/post.php?post=2393&ac
tion=edit" title="Edit this item">Edit</a> | </span><span class='inline
hide-if-no-js'><a href="#" class="editinline" title="Edit this item
inline">Quick Edit</a> | </span><span class='trash'><a class='submitdelete'
title='Move this item to the Trash'
href='http://department-test-wp.hackinghistory.ca/wp-admin/post.php?post=2393&ac
tion=trash&_wpnonce=49be643928'>Trash</a> | </span><span class='view'><a
href="http://department-test-wp.hackinghistory.ca/people/anderson-julie/"
title="View “Anderson, Julie”" rel="permalink">View</a></span></div>
<div class="hidden" id="inline_2393">
<div class="post_title">Anderson, Julie</div>
<div class="post_name">anderson-julie</div>
<div class="post_author">15</div>
<div class="comment_status">closed</div>
<div class="ping_status">closed</div>
<div class="_status">publish</div>
<div class="jj">26</div>
<div class="mm">11</div>
<div class="aa">2011</div>
<div class="hh">20</div>
<div class="mn">35</div>
<div class="ss">11</div>
<div class="post_password"></div><div class="post_parent">0</div><div class="menu_order">0</div><div class="post_category" id="geographical-areas_2393">27,233</div><div class="post_category" id="campus_2393">104</div><div class="post_category" id="periods_2393">140</div><div class="tags_input" id="thematic-areas_2393">Hagiography, Lombardy</div><div class="post_category" id="role_2393">144</div><div class="post_format"></div></div></td> <td class="author column-author"><a href="edit.php?post_type=people&author=15">pawel</a></td>
</tr>
Original comment by mopto...@gmail.com
on 10 Feb 2012 at 12:28
Well, this is frustrating... I tested this too prior to commit. Sorry for the
trouble. I wonder if it's me who's having problems with SVN. Sometimes it can
take WP a while to package up the head to the zip file.
WP only sends data to the populate_custom_column_data() function if it is
custom data... normal columns don't get handled there. I'm attaching my
CCTM_Columns.php file for you for comparison.
Original comment by ever...@fireproofsocks.com
on 10 Feb 2012 at 7:55
Attachments:
ok, the code is the same, so svn is not hte issue. Is there somewhere else I
can debug, besides populate_data_columns? Maybe there's a test going wrong
somewhere?
wait, I think I may have found the problem:
from:
http://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_colum
n
-----
The filter described in here works both for built in post types as well as
custom post types. Note that if the custom post type has 'hierarchical' =>
true, then the correct action hook to use is manage_pages_custom_column.
yes! I added this at line 103 in loader.php:
add_action('manage_pages_custom_column', array(CCTM::$Columns,
'populate_custom_column_data'));
now it works! yay.
Original comment by mopto...@gmail.com
on 11 Feb 2012 at 11:27
Genius! I didn't test this on hierarchical post-types. I'll add that to the
code. Thanks for catching that!
Original comment by ever...@fireproofsocks.com
on 11 Feb 2012 at 3:39
Original issue reported on code.google.com by
fireproofsocks
on 26 Mar 2011 at 1:22