\WP_Stager_Integration\Calendar::render_day(int $year = null, int $month = null, int $day = null, array $args = array()): void
\WP_Stager_Integration\Calendar::render_day(int $year = null, int $month = null, int $day = null, array $args = array()): voidDescription
Renders a single day.
Renders the current day if either $year, $month or $day is missing.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$year | int | (Optional) The date's year |
$month | int | (Optional) The date's month number (1-12) |
$day | int | (Optional) The date's day of the month (1-31) |
$args | array | (Optional) An array of calendar settings. See \WP_Stager_Integration\Calendar::render_calendar() for accepted arguments. |
Returns:
void
Information
| File | class-calendar.php line 968 |
|---|---|
| See also |
|
Full Code
/**
* Renders a single day.
*
* Renders the current day if either <code>$year</code>, <code>$month</code> or <code>$day</code> is missing.
*
* @param int $year (Optional) The date's year
* @param int $month (Optional) The date's month number (1-12)
* @param int $day (Optional) The date's day of the month (1-31)
* @param array $args (Optional) An array of calendar settings. See <code>\WP_Stager_Integration\Calendar::render_calendar()</code> for accepted arguments.
*
* @return void
*
* @see \WP_Stager_Integration\Calendar::render_calendar() for accepted <code>$args</code>.
*/
public static function render_day( $year = null, $month = null, $day = null, $args = array() ) {
// Type casting
$year = (int) $year;
$month = (int) $month;
$day = (int) $day;
$args = (array) $args;
// Calculate day timestamp
if ( ! $year || ! $month || ! $day ) {
$timestamp = time();
} else {
// Turn into timestamp
$timestamp = self::calculate_local_timestamp( sprintf( '%04d-%02d-%02d 00:00:00', $year, $month, $day ) );
}
// Calculate start & end
$day_start = self::calculate_timestamp_day_start( $timestamp ); // Midnight
$day_end = self::calculate_timestamp_day_end( $day_start );
self::render_range( $day_start, $day_end, $args );
}💡 If you ever get stuck or have a question, please check our FAQs, our Free Integration Service, our paid Full Integration Service, or reach out to us!

Get WP Stager Integration
🎁 Limited offer: Use code WELCOME26 to get your first month for free!

