This file contains hidden or 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
const MEDIA_QUERY = '(prefers-reduced-motion: reduce)'; | |
const CSS_PROPERTY = '--reduced-motion-play-state'; | |
const documentRoot = document.documentElement; | |
const handleMediaChange = (event) => { | |
if (event.matches) { | |
documentRoot.style.setProperty(CSS_PROPERTY, 'paused'); | |
} else { |
This file contains hidden or 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
//To fetch the list of all registered blocks in the JS, we can do something like this: | |
wp.blocks.getBlockTypes() | |
//Also, to get a list of blocks for a particular namespace, you may use something like this: | |
wp.blocks.getBlockTypes().filter((block) => { return block.name.indexOf(NAMESPACE) !== -1}); |
This file contains hidden or 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
import {useSelect, useDispatch} from '@wordpress/data' | |
//Access the current mode value | |
const { deviceType } = useSelect( select => { | |
const { __experimentalGetPreviewDeviceType } = select( 'core/edit-post' ); | |
return { | |
deviceType: __experimentalGetPreviewDeviceType(), | |
} | |
}, [] ); |
This file contains hidden or 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', function($id, $post, $update): void { | |
// Skip if wp rocket is not activated. | |
if (! function_exists('rocket_clean_domain')) { | |
return; | |
} | |
if (! $update) { | |
return; |
This file contains hidden or 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
add_action( 'init', 'true_register_post_type_init' ); | |
function true_register_post_type_init() { | |
$labels = [ | |
'name' => 'Functions', | |
'singular_name' => 'Function', // admin panel Add-> Function | |
'add_new' => 'Add function', | |
'add_new_item' => 'Add New function', // <title> tag title | |
'edit_item' => 'Edit function', | |
'new_item' => 'New feature', |
This file contains hidden or 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
composer require filp/whoops | |
composer require symfony/var-dumper | |
function registerWhoops() { | |
$whoops = new \Whoops\Run; | |
$whoops->pushHandler( new \Whoops\Handler\PrettyPageHandler ); | |
$whoops->register(); | |
} | |
if ( WP_DEBUG ) { |
This file contains hidden or 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
// slider | |
$slick_slider = $('.slider'); | |
settings_slider = { | |
dots: false, | |
arrows: false | |
// more settings | |
} | |
slick_on_mobile( $slick_slider, settings_slider); | |
// slick on mobile |
This file contains hidden or 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
.slider { | |
opacity: 0; | |
visibility: hidden; | |
transition: opacity 1s ease; | |
&.slick-initialized { | |
visibility: visible; | |
opacity: 1; | |
} |
This file contains hidden or 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
include( locate_template( '/template-parts/case-slider.php', false, false ) ); |
This file contains hidden or 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 | |
$err = ''; | |
$success = ''; | |
global $wpdb, $PasswordHash, $current_user, $user_ID; | |
if (isset($_POST['task']) && $_POST['task'] == 'register') { | |
$first_name = $wpdb->escape(trim($_POST['first_name'])); | |
$last_name = $wpdb->escape(trim($_POST['last_name'])); | |
$email = $wpdb->escape(trim($_POST['email'])); |
NewerOlder