I’m setting the colours etc for channel statuses in the back-end which work on the edit page fine. But I’d also like to use these colours dynamically on the front-end too.
I can get {status} in the channel entries loop. Is there any way to access additional information about the status such as colour?
HI Bhashkar,
Thanks, that’s exactly what I’ve implemented for now and it works fine. It just means if we add new status options in the future there’s a little more work because it relies on updating the conditions (on all relevant templates) and the CSS. It would be nice if I could just add the new status and my templates could automatically handle it.
I guess this is were a custom plugin or new feature could be requested. So that we could pass in the status and get all the properties from the DB.
For now the classes and CSS are the solution I’m going with.
Hi Luke,
You are correct. As while creating the statuses from Control Panel, the color code is also being saved into DB. So a small plugin can be developed to fetch the color code.
But also, I think, it would be easy for you just write a query using the query module like:
{exp:query sql="SELECT highlight AS status_color FROM exp_statuses WHERE status='{status}' AND group_id='1'"}
{status_color}
{/exp:query}Please Note: Within the query group_id can vary according to the status group assigned to that channel.
Here, {status_color} will give the color code of that status color.
I hope, it would help you.
Best Regards,
can you please help with this:
<button [removed]SELECT highlight AS status_color FROM exp_statuses WHERE status=’{status}’”} {status_color} {/exp:query} ; border: none; mix-blend-mode: difference; padding: 10px; text-align: center; text-decoration: none; display: inline-block; font-size: 12px; font-weight: bold; font-variant-caps: petite-caps; margin: 4px 2px; border-radius: 30%;}”>{status}</button>
================================= what’s missing?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.