How to Create a PHP Editorial Calendar - Quantum Designers

How to Create a PHP Editorial Calendar

If you are Developer working for a publisher or media company , this tutorial may help you.

An Editorial Calendar is used to show the advertisers (clients),  the publication dates and ad deadlines dates.  The calendar also shows the main topic of each publication, in this example for a magazine issue.

In this tutorial,  I will show you the dynamic PHP calendar I created for

The calendar is dynamic because it gets automatically updated. In this example , it get updated every two weeks.

1 . Define arrays

I defined four arrays as follows:




For the issue date, you enter all dates in ascending order. It’s important to note that the dates must be entered in MM/DD/YYYY format. Otherwise , the program will crash.

<table class="table responsive" width="auto" cellspacing="0" cellpadding="2" style="font-family:'Roboto': 17px">
  <td width="122" align="center"><strong>Issue Date</strong></td>
    <table border="0">
          <td width="217" height="38" align="left">  

 <td style="text-align: center;" width="109"><strong>Ad Deadline</strong></td>
</tr>  </tbody></table>
<table class="table responsive" cellspacing="0" cellpadding="2" style="font-family: 'Roboto Slab': 17px">
$issue_date = array (

Here you will enter the main topic of the magazine edition. Same for the ad deadline.

You enter them in between quotes and separated by commas, same as you did for the issue date. On the page , this is the column showing in the center of the table.

$title = array (

"STEM - Science, Technology, Engineering & Math",
"HBCUs - Historically Black Colleges & Universities",
"Active Duty/Veteran Military Education/Virtual Education",
"Academic Kickoff",
"Hispanic Heritage Month",
"Recruitment & Retention/Top 100 Degree Producers",
"Careers in Higher Education",
"Native American Heritage Month",
"Health Sciences",
"Comm. Colleges - Top 100 Assoc. Degree Producers - Year in Review"

$ad_deadline = array (
"11/17/2022" );

2. Create the Loop

So far, we only have a page that displays text and dates. It doesn’t do anything for us. The code below , is what does the trick.

We need to create a for loop in order to go through the calendar dates and update accordingly.

Let’s break it in different parts to understand it better.

Since we are working with dates, we need to define a variable that will be equal to today’s date. The php built-in strtotime function converts the date into UNIX timestamp. To read more about this click here

$todays_date = date("m/d/Y"); 
$today = strtotime($todays_date);

In the for loop below, we pass the variable $issue_date.


for($i=0; $i < count($issue_date); $i++)

Here we run an if statement, the logic is the following, if the magazine issue date is greater than today’s date, it means that row on the calendar still didn’t expire. So we display the data on that row. If the date has already passed, the row will not display.

if (strtotime($issue_date[$i]) >= $today)
echo "<tr style=\"text-align: left;\"><td width='90' style='text-align:center';>
$issue_date[$i]</td><td width='480'>$title[$i]</td><td width='90' style='text-align:center';>$ad_deadline[$i]</td></tr>";  

 The script will be looping through all dates every timethe page is loaded. This way, the calendar get automatically updated showing only the upcoming issue dates, topic and ad deadline dates.


To view the live version of this script go to

Scroll to Top