Skip to content

Instantly share code, notes, and snippets.

@verytwisty
verytwisty / block.json
Created October 3, 2024 14:05
Interactivity API block with keydown and keyup directives
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "interactivity/key-test",
"version": "0.1.0",
"title": "Key Test",
"category": "widgets",
"icon": "filter",
"description": "Key Test",
"supports": {
@verytwisty
verytwisty / custom_cat.php
Created January 23, 2017 15:16
Remove Add New Cat from custom Tax
$capabilities = array(
'manage_terms' => false,
'edit_terms' => false,
'delete_terms' => false,
'assign_terms' => 'edit_posts',
);
$args = array(
'capabilities' => $capabilities,
);
<?php
// add ie conditional html5 shim to header
function _s_add_ie_html5_shim () {
echo '<!--[if lt IE 9]>';
echo '<script src="' . get_template_directory_uri() . '/js/html5.js"></script>';
echo '<![endif]-->';
}
add_action('wp_head', '_s_add_ie_html5_shim');
@verytwisty
verytwisty / new_gist_file.php
Created April 27, 2015 10:12
Filter to change the HTML around a featured image.
function custom_post_thumbnail_html( $html ) {
$html = '<div class="featured-image">' . $html . '</div>';
return $html;
}
add_filter( 'post_thumbnail_html', 'custom_post_thumbnail_html' );
a[href^=tel]{ color:#F00; text-decoration:none;}
@verytwisty
verytwisty / new_gist_file.js
Created April 14, 2015 15:30
jQuery if window width this size
if( $( window ).width() < 768 ){
// Do Something Here;
}else{
// Do Something Else Here;
}
@verytwisty
verytwisty / new_gist_file.php
Created April 10, 2015 08:23
if has action
<?php
if ( has_action( 'init', 'custom_plugin_code' ) ) {
remove_action( 'init', 'custom_plugin_code' );
add_action( 'init', 'my_content_code' );
}
?>
<footer>
<?php custom_footer();?>
</footer>
@verytwisty
verytwisty / new_gist_file.css
Created April 8, 2015 10:23
Image Replacement CSS
h1.logo {
width: 160px;
height: 65px;
background: url(img.png);
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
margin: 0 0 50px 0;
}
@verytwisty
verytwisty / remove-actions.php
Created April 8, 2015 09:35
remove actions
<?php
if ( has_action( 'init', 'custom_plugin_code' ) ) {
remove_action( 'init', 'custom_plugin_code' );
add_action( 'init', 'my_content_code' );
}
?>