El código es este:
Código:
Este codigo es el que hace que cambie cada según la hora:<?php function fsb_display_image() { global $fsb_options; if($fsb_options) { $image = '<img src="' . $fsb_options['image'] . '" id="fsb_image"/>'; } // output the image echo $image; } add_action('wp_footer', 'fsb_display_image');
Código:
Y yo lo resolví así:<?php date_default_timezone_set("GMT"); // set to your time zone $thetime = date("H"); // H means it just grabs the hour in 24 hour format // this section grabs the correct stylesheet by time, don't alter if you can help it if($thetime > 00 AND $thetime < 06) { echo "http://www.turisrialp.cat/img/ima01.jpg";} // between midnight and 6am elseif($thetime > 05 AND $thetime < 12) { echo "http://www.turisrialp.cat/img/ima01.jpg";} // between 6am and 12pm elseif($thetime > 11 AND $thetime < 19) { echo "http://www.turisrialp.cat/img/ima02.jpg";} // between 12pm and 7pm elseif($thetime > 18 AND $thetime < 23) { echo "http://www.turisrialp.cat/img/ima02.jpg";} // between 7pm and 11pm elseif($thetime = 23) { echo "http://www.turisrialp.cat/img/ima03.jpg";} // 11pm elseif($thetime = 00) { echo "http://www.turisrialp.cat/img/ima03.jpg";} // midnight ?>"
Código:
Como he comentado, funciona, pero en la pagína wp-admin solo muestra la imagen.<img src="<?php date_default_timezone_set("GMT"); // set to your time zone $thetime = date("H"); // H means it just grabs the hour in 24 hour format // this section grabs the correct stylesheet by time, don't alter if you can help it if($thetime > 00 AND $thetime < 06) { echo "http://www.turisrialp.cat/img/ima01.jpg";} // between midnight and 6am elseif($thetime > 05 AND $thetime < 12) { echo "http://www.turisrialp.cat/img/ima01.jpg";} // between 6am and 12pm elseif($thetime > 11 AND $thetime < 19) { echo "http://www.turisrialp.cat/img/ima02.jpg";} // between 12pm and 7pm elseif($thetime > 18 AND $thetime < 23) { echo "http://www.turisrialp.cat/img/ima02.jpg";} // between 7pm and 11pm elseif($thetime = 23) { echo "http://www.turisrialp.cat/img/ima03.jpg";} // 11pm elseif($thetime = 00) { echo "http://www.turisrialp.cat/img/ima03.jpg";} // midnight ?>" id="fsb_image" />
Lo he probado también con funciones, pero no hay manera.
ALgun consejo?
Gracias