# jetpack/16.3-a.7/modules/wordads/php/class-wordads-formats.php

Jetpack – WP Security, Backup, Speed, &amp; Growth, version 16.3-a.7. 51 lines.

- Page: https://pluginprobe.com/plugins/jetpack/16.3-a.7/code/modules/wordads/php/class-wordads-formats.php
- Raw: https://pluginprobe.com/plugins/jetpack/16.3-a.7/raw/modules/wordads/php/class-wordads-formats.php
- Modified: 2025-11-24T17:00:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/jetpack/16.3-a.7/code/modules/wordads/php/class-wordads-formats.php#L10-L20`.

```php
<?php
/**
 * WordAds Formats Class file.
 *
 * This file contains the definition of the WordAds_Formats class, which handles
 * determining the appropriate WordAds format slug based on ad slot dimensions.
 *
 * @package automattic/jetpack
 */

declare( strict_types = 1 );

if ( ! defined( 'ABSPATH' ) ) {
	exit( 0 );
}

/**
 * Class WordAds_Formats
 *
 * Set of WordAds methods working with formats and Ad dimensions.
 */
class WordAds_Formats {
	/**
	 * Determine the WordAds format based on the ad dimensions.
	 *
	 * @param int $width  The width of the ad slot.
	 * @param int $height The height of the ad slot.
	 *
	 * @return string WordAds Format enum.
	 */
	public static function get_format_slug( int $width, int $height ): string {
		if ( $width === 300 && $height === 250 ) {
			return 'gutenberg_rectangle';
		}

		if ( $width === 728 && $height === 90 ) {
			return 'gutenberg_leaderboard';
		}

		if ( $width === 320 && $height === 50 ) {
			return 'gutenberg_mobile_leaderboard';
		}

		if ( $width === 160 && $height === 600 ) {
			return 'gutenberg_skyscraper';
		}

		return '';
	}
}

```
