Add Custom Post Type Slugs to Admin Body Class
When in Admin mode, this plug-in adds classes to the <body> tag to let your CSS know where you are. For example, if you are viewing the list of all your Posts, you would get this additional class: edit-list-post And, when you are editing a Post, something like this: edit-page-post Alternatively, for
When in Admin mode, this plug-in adds classes to the <body> tag to let your CSS know where you are.
For example, if you are viewing the list of all your Posts, you would get this additional class: edit-list-post And, when you are editing a Post, something like this: edit-page-post
Alternatively, for custom posts, for example “movie”, you would see either: edit-list-movie or: edit-page-movie
This allows you to write custom CSS and JS to interact with these varying edit pages within WP.
Please let me know if you have any questions/suggestions/thoughts, Atg
- 01Download the ZIP
- 02Unzip the ZIP
- 03Copy/paste the unzipped files into your WP plug-in directory ( /wp-content/plugins/ )
- 04From within WP’s Plugin Admin panel, Activate the plug-in
- 05Write some wicked CSS and JS to amaze your friends and befuddle your enemies!
Frequently asked questions.
What does this do, exactly?
Additional CSS classes are added to the HTML body tag when certain pages load in Admin mode
What classes?
If you are in WP Admin, if you click Posts, you will see a list of all your Posts, and the CSS class edit-list-post will be added to the HTML body tag. If you click a specific Post, you will enter the edit page for that Post, and the CSS class edit-page-post will be added to the HTML body tag. Note the difference between the two: edit-list-post vs. edit-page-post , list vs. page Similarly, if you click Pages, the same thing as above will happen, except the word post will be replaced with the word page in each of the CSS classes. Futher, if you have custom post types, the word post will be replaced with whatever your custom post type is, so a custom post type called “Movies” will results in the following CSS classes being added: edit-list-movie vs. edit-page-movie