\WP_Stager_Integration\Calendar::render_week(int $year = null, int $week_number = null, array $args = array()): void

Description

Renders a specific week.

Renders the current week if no $week_number and $year are passed.

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

Parameters:

ParameterTypeDescription
$year int (Optional) The year (e.g., 2025)
$week_number int (Optional) The ISO week number (1–53)
$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 1009
See also

Full Code

/**
 * Renders a specific week.
 *
 * Renders the current week if no <code>$week_number</code> and <code>$year</code> are passed.
 *
 * Otherwise:
 * Uses the current year if no <code>$year</code> is passed;
 * Uses the current week if no <code>$week_number</code> is passed.
 *
 * @param int   $year           (Optional) The year (e.g., 2025)
 * @param int   $week_number    (Optional) The ISO week number (1–53)
 * @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_week( $year = null, $week_number = null, $args = array() ) {

    // Type casting
    $year        = (int) ($year ?: self::get_year_number());
    $week_number = (int) ($week_number ?: self::get_week_number());
    $args        = (array) $args;

    // Calculate week boundaries explicitly
    $week_start = (int) self::calculate_timestamp_week_start( $year, $week_number );
    $week_end   = (int) self::calculate_timestamp_week_end( $year, $week_number );

    self::render_range( $week_start, $week_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!