I am one to always tell my clients “Yes, I can do that!” and then figure it out later. Sometimes it turns out easy, sometimes it takes longer than it should. I never give up on an idea either. If it gets to a point that I can’t figure it out, then I’ll move on to finding someone who can.
A client recently asked me to put a different photograph on their homepage each day, a “Photo of the Day,” just to give their customers another reason to visit their website. “No problem,” I say. I was sure that I could find a WordPress plugin that would do that easily. Well, a good 30 minutes later of Google searching and no luck. Surely, someone would have built a plugin for that? To be fair, there were a couple of old plugins that hadn’t been updated in years, so they were unusable. What to do?
Oftentimes I have to step back, or move to something else, or sleep on it before a solution presents itself. This was the case this time. After coming back to the project the next day, I came across the single line of PHP code again. And it clicked. Those who do what I do know it’s not a simple as just adding the code, so now I have to figure out the best way to get the function to display a new photo how I want, where I want on the page. Another search ensued and I ended up adding more code to make a widget run the PHP code, along with some CSS to get the look right.
The moral of the story? Never give up! There is always a way to achieve what you want if you just keep at it.
The website that this work is on you ask? psbtrust.com
And the single line of code?
<?php $dayofyear = date(‘z’); ?><img src=”/wp-content/uploads/2018/09/<?php echo $dayofyear ?>.jpg” class=”daily-photo” />