RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts</strong | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.69% (5.89%*) • Home Loan Fixed: 5.39% (6.59%*) • Fixed: 5.39% (6.59%*) • Variable: 5.69% (5.89%*) • Investment IO: 5.69% (6.48%*) • Investment PI: 5.39% (6.59%*)

Display a Different Image Each Day with Shortcode

This snipped will display a different image for each day of the week. As pointless as it is, it was requested way back in the Internoetics days. Create an image as monday.jpg, tuesday.jpg, and so on.

1
<?php 
2
/*
3
 Display a Different Image Each Day of the Week with Shortcode
4
 http://www.beliefmedia.com/code/wp-snippets/day-image
5
*/
6
 
7
function beliefmedia_day_image($images = 'images/dir') {
8
 $today = strtolower(date('l'));
9
 return (file_exists($images . '/' . $today . '.jpg')) ? '<img width="50" height="50" src="' . $images . '/' . $today . '.jpg" border="0">' : 'No image was found for ' . $today;
10
}
11
add_shortcode('dayimage', 'beliefmedia_day_image');
12
 
13
/* Usage */
14
echo beliefmedia_day_image();

There's also a PHP function.

If you wanted to expand upon the code above, you could create all sorts of image combination effects.

1
$today = date('l'); // Day of week
2
$month = date('m'); // Month
3
$dweek = date('j'); // Day of the month without leading zeros - use "d" for a leading zero.

View the PHP manual for ideas on date usage.

■ ■ ■

 
Download our complimentary 650-page guide on marketing for mortgage brokers. We'll show you exactly how we generate billions in volume for our clients.
Finance Guide, Cropped Top and Bottom
  Timezone: 1 · [ CHANGE ]

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Leave a comment