I created a 'Light' theme and 'Dark' theme in the WP dashboard (via Advanced Custom Fields) that will determine how a series of buttons will look, depending on which theme is selected:
<?php $learn_more = get_field('learn_more_button'); if( $learn_more == 'Light' ) { $btn_background = '#E0EFF8'; $btn_text = '#007BC1'; $back_btn_link = '#E0EFF8'; } else { $btn_background = '#007BC1'; $btn_text = '#E0EFF8'; $back_btn_link = '#0C4F70'; } ?>
So far, the text and background color render correctly for both themes:
<div class="layout center"><a style="background-color:<?php echo $btn_background ?>; color:<?php echo $btn_text ?>" class="button coe-button" href="<?php echo get_field('coe_external_link'); ?>" target="_blank">Learn More</a></div>
...but I also want to set up a hover animation on the buttons that will reverse the text and background color - whatever they are - when hovered on:
With the following CSS, only the 'Light' themed buttons complete the animation, while the buttons with the 'Dark' theme do nothing:
<style> .coe-button:hover { color:<?php echo $btn_background ?>!important; background-color:<?php echo $btn_text ?>!important; } </style>
Is there a way to make this work? Not sure if I'm doing something wrong or if this is just a limitation of the languages but I could use some guidance. Thanks!