This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin best-contrast($text-color, $bg-color, $level) { | |
$lum1: luminance($text-color); | |
$lum2: luminance($bg-color); | |
$contrast: $lum1 / $lum2; | |
@if $contrast < 1 { | |
$contrast: 1 / $contrast; | |
} | |
@if $level == AA { | |
@if $contrast < 4.5 { | |
// Text color does not meet AA contrast ratio, adjust color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2021-09-07T07:45:55.177Z","extensionVersion":"v3.4.3"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getLuminance($val) { | |
$hex = $val; | |
// Get int RGB values from the hex. | |
list($r, $g, $b) = sscanf($hex, "#%02x%02x%02x"); | |
// Calculate according to the formula | |
$red = 0.2126 * ($r/255); | |
$green = 0.7152 * ($g/255); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin for-phone-only { | |
@media (max-width: 599px) { @content; } | |
} | |
@mixin for-tablet-portrait-up { | |
@media (min-width: 600px) { @content; } | |
} | |
@mixin for-tablet-portait-only { | |
@media (min-width: 600px) and (max-width: 899px) { @content; } | |
} | |
@mixin for-tablet-landscape-up { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function update_post_slug( $data, $postarr ) { | |
if ( ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) { | |
$data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'] ), $postarr['ID'], $data['post_status'], $data['post_type'], $data['post_parent'] ); | |
} | |
return $data; | |
} | |
add_filter( 'wp_insert_post_data', 'update_post_slug', 99, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'save_post','changeLastModified' ); | |
function changeLastModified( $post ){ | |
if ( 'YOUR_CUSTOM_POST_TYPES_NAME' == get_post_type( $post ) ) { | |
if( ! ( wp_is_post_revision( $post ) ) ) { | |
$sync_time = array(); | |
$sync_time['ID'] = wp_get_post_parent_id( $post ); | |
$sync_time['post_modified'] = get_post_field( 'post_modified', $post, 'raw' ); | |
remove_action( 'save_post', 'changeLastModified' ); | |
wp_update_post( $sync_time, true ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'meta_key' =>'your_checkboxkey', | |
'meta_value'=>'1' | |
); | |
$the_query = new WP_Query( $args ); | |
?> | |
<!-- Loop continues here --> |