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

Description

Renders a full year.

Renders the current year if no $year is passed.

Parameters:

ParameterTypeDescription
$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 1068
See also

Full Code

/**
 * Renders a full year.
 *
 * Renders the current year if no <code>$year</code> is passed.
 *
 * @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_year( $year = null, $args = array() ) {

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

    // Get data
    $year = (int) ($year ?: wp_date( 'Y' ));

    // Calculate start & end
    $year_start = self::calculate_local_timestamp( "$year-01-01 00:00:00" );
    $year_end   = self::calculate_local_timestamp( "$year-12-31 23:59:59" );

    self::render_range( $year_start, $year_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!