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 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts