Change the color of %value% in the attribute depending on value itself

is it possible to change the color of %value% in the request attribute depending on the value itself

field name for my attribute is taskstatus,
will this code work?

<?php
add_filter(
    'hivepress/v1/models/request/attributes',
    function( $attributes ) {
        if ( isset( $attributes['taskstatus'] ) ) {
            if ( $attributes['taskstatus'] == "active" ) {
                echo '<span style="color:green;">' . $attributes['taskstatus'] . '</span>';
            } else if ( $attributes['taskstatus'] == "cancelled") {
                echo '<span style="color:red;">' . $attributes['taskstatus'] . '</span>';
            } else if ( $attributes['taskstatus'] == "open") {
                echo '<span style="color:blue;">' . $attributes['taskstatus'] . '</span>';
            } else {
                echo '<span>' . $attributes['taskstatus'] . '</span>';
            }
        }
        return $attributes;
    },
    1000
);

Hi,

Sorry, there’s no simple code snippet for this, it would require a custom implementation. If customizations beyond the available features are required for your site, please consider hiring someone for custom work https://fvrr.co/32e7LvY

Oh ok thank your for your reply.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.