We make out the admin panel. Adding a background to an article based on its state.
I think it will be interesting for those who are used to making an admin panel WordPress convenient for you and your clients. Besides, article will be a great addition to the article, which is already on my site “Highlight Post Status in WordPress“
1 2 3 4 5 6 7 8 9 10 11 12 |
add_action('admin_footer','posts_status_color'); function posts_status_color(){ ?> <style> .status-draft{background: #FCE3F2 !important;} .status-pending{background: #87C5D6 !important;} .status-publish{/* no background keep wp alternating colors */} .status-future{background: #C6EBF5 !important;} .status-private{background:#F2D46F;} </style> <?php } |
Your actions will look something like this:
I found the code on one site which, I have support. I found it comfortable, so I decided to post it to you. Good luck in developing user-friendly sites on WordPress.
/*
- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.
From the point of view of the validity of the resulting html script, wiser to use not admin_footer, а admin_head. Read more here – htmlbook.ru/html/style
I don't quite agree with you. Now we are talking about the WordPress admin area., not about the site as a whole. Admin is not indexed, which means that there you can insert the code in the place where it is convenient and at the bottom the code is inserted only in order to initially load the content in the browser.
On the user side on the site itself, this code will not be visible, this effect is provided by the add_action action(‘admin_footer’,’posts_status_color’);
thanks for the comment.
So validity is needed only for indexing? :)
Modern browsers, almost certainly, display content correctly, older ones may “break” appearance / structure of the console. Yes, he will, that modern browsers will display correctly is nothing more than the foresight of the developers. Everything can change.
Well, everything can change, but many, including Google, have already abandoned support for IE7. Besides, there is nothing here, whatever is not supported by different browsers, we just override the standard styles. And you can do it all in the form of an additional plugin and disable it later.
I will specially change the code for the plugin, so stay tuned i will post it. Then you can, if necessary, its easy to deactivate the unnecessary plugin in case of problems.