WebDevStudios / CPT_Core

This is a helper class for creating custom post types.. I'm sure it doesn't cover everything. PRs welcome.
78 stars 13 forks source link

Support for Dashboard At Glance Widget #2

Open Mte90 opened 10 years ago

Mte90 commented 10 years ago

i've seen this snippet and i think that will be useful if integrated in this library.

http://wpsnipp.com/index.php/functions-php/wordpress-post-types-dashboard-at-glance-widget/

Mte90 commented 8 years ago

any news for that?

PavelK27 commented 7 years ago

image

register_via_cpt_core( array(
    __( 'Q & A item', 'your-text-domain' ), // Singular
    __( 'Q & A items', 'your-text-domain' ), // Plural
    'q-and-a-items' // Registered name/slug
 ) );

 register_via_cpt_core( array(
     __( 'Test CPT', 'your-text-domain' ), // Singular
     __( 'Test CPTs', 'your-text-domain' ), // Plural
     'tests' // Registered name/slug
 ) );

register_via_cpt_core( array(
    __( 'ABC item', 'your-text-domain' ), // Singular
    __( 'ABC items', 'your-text-domain' ), // Plural
    'abcs' // Registered name/slug
 ) );

I didn't add css for that, so it uses default WordPress icons for "At a glance" items. I don't think we need a custom icon here, because it always will be the same for each CPT registered via CPT Core. Regarding the code itself, I had to use static variable to count number of CPT's registration calls, to limit "At a glance" widget modifications. Also, I'm not sure if we should keep this code in library or we need to move it into code snippets as an example. @JayWood what are your thoughts on this?