Wordpress

How To Show Some Content Until A Certain Date In Wordpress Using PHP

Posted by Weston Ganger on March 29, 2016

I needed to show an event poster on a clients site. I wanted it to automatically hide after a certain date. This solution saves the client money and saves your hassle.

Here’s how to do it using basic PHP


<?php if( strtotime('2015-10-16') > time() ): ?>
  <img src="images/my_img.png">
<?php endif; ?>

So now the poster will show until Oct 16, 2015. Just remember to clean up your code the next time you work on the project after this date.


Related External Links:


Posted in Wordpress and Tagged with php wordpress 


Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts