Basically, I have created a table that shows upcoming tournaments on a tournaments listing page. The info in each row is pulled through ACF fields and from posts in a custom post type called “tournaments”. The post is where I have set up an ACF field with a true/false checkbox. If admin checks the box, I want the background of the single row in the table to turn green to highlight that it is “featured”.
Can this be accomplished?
Based on my own logic and research, I have gotten as far as this:
?php
$featured_tournament = get_field("featured_tournament");
if($featured_tournament==true){
document.getElementById("tournaments-listing").getElementsByTagName("tr").addClass("green");
} else {
//Do Nothing
}
?>
(But this doesn’t execute correctly and breaks the page.)
I cannot seem to get this to work.
I have attached screenshots of the field, what the tournament list I am referring to looks like, and the tournament post in the backend (wp-admin).
Any input is appreciated. Thank you.