[wp-trac] [WordPress Trac] #24313: Filter Columns by View

WordPress Trac noreply at wordpress.org
Sat May 11 01:22:05 UTC 2013


#24313: Filter Columns by View
-----------------------------+------------------------------
 Reporter:  chriscct7        |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Administration   |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |
-----------------------------+------------------------------
Changes (by SergeyBiryukov):

 * component:  Appearance => Administration


Old description:

> After searching extensively for a way to do this, and discussing this
> with fellow WordPress developers, I believe I have found a feature that
> should be added to WordPress.
>
> When you make a new custom post type, if you have WordPress register a UI
> for it, it outputs a screen named "All XXXX's". Within these, WordPress
> automatically adds filters. So let's say I've registered a CPT called
> Downloads.
>
> So I can now use the built in UI for Downloads and filter the page to
> show just pending downloads, or just published downloads, for instance.
>
> However, the issue becomes what if you want to display a column for some
> views, but not others. For instance, if Downloads has a column called
> "Sales" where the number of sales of that particular download is stored,
> it makes no sense to show that column on Pending Downloads (since they
> can't have sales before being published).
>
> Currently, at least after days of trying to find a way of doing this,
> there is no way to do this for the tables registered by WordPress. If I
> make my own List_Table, then I can do this.
>
> However, there should be a way of adding columns based on filter, so that
> a developer who adds a column programmatically can go:
>
> if($view != pending){
> // register sales column
> }
>

> Feel free to correct me if I've overlooked a method of doing this.
>
> -Chris

New description:

 After searching extensively for a way to do this, and discussing this with
 fellow WordPress developers, I believe I have found a feature that should
 be added to WordPress.

 When you make a new custom post type, if you have WordPress register a UI
 for it, it outputs a screen named "All XXXX's". Within these, WordPress
 automatically adds filters. So let's say I've registered a CPT called
 Downloads.

 So I can now use the built in UI for Downloads and filter the page to show
 just pending downloads, or just published downloads, for instance.

 However, the issue becomes what if you want to display a column for some
 views, but not others. For instance, if Downloads has a column called
 "Sales" where the number of sales of that particular download is stored,
 it makes no sense to show that column on Pending Downloads (since they
 can't have sales before being published).

 Currently, at least after days of trying to find a way of doing this,
 there is no way to do this for the tables registered by WordPress. If I
 make my own List_Table, then I can do this.

 However, there should be a way of adding columns based on filter, so that
 a developer who adds a column programmatically can go:
 {{{
 if($view != pending){
 // register sales column
 }
 }}}

 Feel free to correct me if I've overlooked a method of doing this.

 -Chris

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/24313#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list