Reply To: How to make a button image active?

#5163
Ron
Keymaster

You could use PHP Code Widget and do something like this:

Example:

<?php
global $wp_query;
$current_ID = $wp_query->post->ID;

// Button 1
if ( $current_ID == 10 )
     echo '<a href="https://ronangelo.com"><img src="https://ronangelo.com/button1_active.jpg" /></a>';
else
     echo '<a href="https://ronangelo.com"><img src="https://ronangelo.com/button1_normal.jpg" /></a>';

// Button 2
if ( $current_ID == 15 )
     echo '<a href="https://ronangelo.com"><img src="https://ronangelo.com/button2_active.jpg" /></a>';
else
     echo '<a href="https://ronangelo.com"><img src="https://ronangelo.com/button2_normal.jpg" /></a>';

?>

In the example, numbers 10 and 15 are the post id of your target post. The example above is for 2 link buttons. You’re going to do the code for all your link buttons.