\WP_Stager_Integration\Calendar::render_month(int $month = null, int $year = null, array $args = array()): void

Description

Renders a single calendar month.

Renders the current month if no $month and $year are passed.

Otherwise: Uses the current month if no $month is passed; Uses the current year if no $year is passed.

Parameters:

ParameterTypeDescription
$month int (Optional) The month (1-12) to render. Defaults to the current month.
$year int (Optional) The year to render. Defaults to the current year.
$args array (Optional) An array of calendar settings. See \WP_Stager_Integration\Calendar::render_calendar() for accepted arguments.

Returns:

void

Information

Fileclass-calendar.php line 1040
See also

Full Code

/**
 * Renders a single calendar month.
 *
 * Renders the current month if no <code>$month</code> and <code>$year</code> are passed.
 *
 * Otherwise:
 * Uses the current month if no <code>$month</code> is passed;
 * Uses the current year if no <code>$year</code> is passed.
 *
 * @param int   $month  (Optional) The month (1-12) to render. Defaults to the current month.
 * @param int   $year   (Optional) The year to render. Defaults to the current year.
 * @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_month( $month = null, $year = null, $args = array() ) {

    // Type casting
    $args = (array) $args;

    // Get data
    $month = (int) ($month ?: self::get_month_number());
    $year  = (int) ($year ?: self::get_year_number());

    // Calculate start & end
    $month_start = self::calculate_timestamp_month_start( $year, $month );
    $month_end   = self::calculate_timestamp_month_end( $year, $month );

    self::render_range( $month_start, $month_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!