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 | |
/** | |
* Remove "Patterns" menu item from the "Appearance" submenu | |
*/ | |
add_action('admin_menu', function() { | |
remove_submenu_page('themes.php', 'site-editor.php?path=/patterns'); | |
}); |
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
jQuery(document).ready(function($){ | |
if ( $('.map-slider-component').length ) { | |
$('.map-slider-component .select-city').select2({ | |
width: '100%', | |
minimumResultsForSearch: Infinity // hide the search box | |
}); | |
// Custom class provision upon select2 events |
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
/** | |
* Attaches the specified template to the posts of the identified post type. | |
* | |
* @params $post_type The name of the post type to attach the template to. | |
* @params $template_path The template's filename (assumes .php' is specified) | |
* | |
* @returns empty array if the post type does not have posts; otherwise, | |
* the post id array of the updated posts. | |
*/ | |
function attach_template_to_post_type( $post_type, $template_file_name ) { |
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 | |
// Option 1: Use `WP_Query` | |
$query = new WP_Query( | |
array( | |
'post_type' => 'page', | |
'title' => 'Sample Page', | |
'post_status' => 'all', | |
'posts_per_page' => 1, | |
'no_found_rows' => true, | |
'ignore_sticky_posts' => true, |
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 | |
if (!function_exists('write_log')) { | |
function write_log($log) { | |
if (true === WP_DEBUG) { | |
if (is_array($log) || is_object($log)) { | |
error_log(print_r($log, true)); | |
} else { | |
error_log($log); | |
} |
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 | |
global $post; | |
if ( is_a($post, 'WP_Post') ) : | |
$post_id = $post->ID; | |
$elementor_data = get_post_meta($post_id, '_elementor_controls_usage', true); | |
$has_fl_map = array_key_exists('fl-map', $elementor_data); |
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
/** | |
* VERSION 1 - DEVICE-SPECIFIC + GLOBAL | |
* ----------------------------------------------------------------------------------------------------- | |
*/ | |
const checkIphone = () => { | |
const u = navigator.userAgent | |
return !!u.match(/iPhone/i) | |
}, | |
checkAndroid = () => { |
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 | |
$mime_types = array( | |
'.3dm' => 'x-world/x-3dmf', | |
'.3dmf' => 'x-world/x-3dmf', | |
'.a' => 'application/octet-stream', | |
'.aab' => 'application/x-authorware-bin', | |
'.aam' => 'application/x-authorware-map', | |
'.aas' => 'application/x-authorware-seg', | |
'.abc' => 'text/vnd.abc', | |
'.acgi' => 'text/html', |
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
/* Copy Button plugin | |
------------------------------------------------------------------------------------------------ | |
@here https://github.com/arronhunt/highlightjs-copy/styles/highlightjs-copy.css | |
*/ | |
.hljs-copy-wrapper { | |
position: relative; | |
overflow: hidden; | |
} | |
.hljs-copy-wrapper:hover .hljs-copy-button, |
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 opts = { | |
// ... | |
} | |
document.querySelectorAll('.my-splide-class').forEach( function(carousel) { | |
const mySplide = new Splide( carousel, opts ); | |
// ... |
NewerOlder