-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions-breakpoints.php
59 lines (50 loc) · 1.31 KB
/
functions-breakpoints.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Breakpoint functionality.
*
* @package Respect_Art_Direction
*/
/**
* Register a new break point.
*
* @param string $breakpoint_name Breakpoint name.
* @param string $media_query Media query properties for the breakpoint.
*/
function rad_add_breakpoint( $breakpoint_name, $media_query = '' ) {
global $rad_breakpoints;
$rad_breakpoints[ $breakpoint_name ] = $media_query;
}
/**
* Register multiple breakpoints.
*
* @param array $breakpoints Associative array of breakpoint names and media query text.
*/
function rad_add_breakpoints( $breakpoints ) {
global $rad_breakpoints;
foreach ( $breakpoints as $breakpoint_name => $media_query ) {
$rad_breakpoints[ $breakpoint_name ] = $media_query;
}
}
/**
* Retrieve a breakpoint.
*
* @param string $breakpoint_name Breakpoint to retrieve.
*
* @return bool|mixed False if breakpoint does not exist, breakpoint data if it does.
*/
function rad_get_breakpoint( $breakpoint_name ) {
global $rad_breakpoints;
if ( empty( $rad_breakpoints[ $breakpoint_name ] ) ) {
return false;
}
return $rad_breakpoints[ $breakpoint_name ];
}
/**
* Remove a breakpoint.
*
* @param string $breakpoint_name Breakpoint to remove.
*/
function rad_remove_breakpoint( $breakpoint_name ) {
global $rad_breakpoints;
unset( $rad_breakpoints[ $breakpoint_name ] );
}