View gb-query-block-filter.php
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 | |
// GenerateBlocks variant of pre_get_posts for the query block | |
add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) { | |
if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'custom-grid-class' ) !== false ) { | |
$query_args['meta_key'] = 'field_name'; | |
$query_args['orderby'] = 'meta_value'; // better for strings | |
// $query_args['orderby'] = 'meta_value_num'; // better for numbers | |
$query_args['order'] = 'ASC'; |
View remove-empty-p.php
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_filter( 'the_content', 'remove_empty_p', 20, 1 ); | |
function remove_empty_p( $content ){ | |
// clean up p tags around block elements | |
$content = preg_replace( array( | |
'#<p>\s*<(div|aside|section|article|header|footer)#', | |
'#</(div|aside|section|article|header|footer)>\s*</p>#', | |
'#</(div|aside|section|article|header|footer)>\s*<br ?/?>#', | |
'#<(div|aside|section|article|header|footer)(.*?)>\s*</p>#', | |
'#<p>\s*</(div|aside|section|article|header|footer)#', |
View scroll-direction.js
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
window.addEventListener( 'DOMContentLoaded', ()=> { | |
const body = document.body, | |
scrollUp = "scroll-up", | |
scrollDown = "scroll-down", | |
offset = 0; | |
let lastScroll = window.pageYOffset; | |
if ( lastScroll > offset ) { | |
body.classList.add(scrollUp); |
View functions.php
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 | |
/** | |
* Gutenberg Block customization for this theme. | |
*/ | |
// gutenberg disable for posts | |
//add_filter('use_block_editor_for_post', '__return_false', 10); | |
// gutenberg disable for post types | |
//add_filter('use_block_editor_for_post_type', '__return_false', 10); |
View github_desktop_ubuntu.sh
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
## Follow this link for further updates to Github Desktop for Ubuntu https://github.com/shiftkey/desktop/releases/latest | |
# UPDATE (2021-10-18): Thanks to Amin Yahyaabadi's message, the updated code is as follows | |
sudo wget https://github.com/shiftkey/desktop/releases/download/release-2.9.3-linux3/GitHubDesktop-linux-2.9.3-linux3.deb | |
### Uncomment below line if you have not installed gdebi-core before | |
# sudo apt-get install gdebi-core | |
sudo gdebi GitHubDesktop-linux-2.9.3-linux3.deb | |
# UPDATE (2021-03-05): Thanks to PaoloRanzi81's comment, the updated code is as follows https://gist.github.com/PaoloRanzi81 |
View hd-just-in-time-css.php
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 | |
/* | |
Plugin Name: Just in Time CSS | |
Plugin URI: https://highrise.digital/ | |
Description: A plugin from Highrise Digital to provide just in time CSS functionality. | |
Version: 1.0 | |
License: GPL-2.0+ | |
Author: Highrise Digital Ltd | |
Author URI: https://highrise.digital/ | |
Text domain: hd-just-in-time-css |