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
let types = wp.blocks.getBlockTypes(); | |
// filter to just the core blocks | |
let core_blocks = types.filter( | |
type => type.name.startsWith('core/') | |
); | |
// grab just the names | |
let block_names = types.map(type => type.name); |
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 add_new_admin_column($columns) | |
{ | |
$columns['last_modified'] = 'Last Modified'; | |
return $columns; | |
} | |
add_filter('manage_posts_columns', 'add_new_admin_column'); |
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 | |
// Check if ACF function `get_field()` exists. If it doesn't exist, display ads won't be shown. | |
// If it does exist and ACF 'hide_display_ads' value is not falsey, show display ads. | |
if(function_exists('get_field') && !get_field('hide_display_ads')) | |
{ | |
echo '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-[your-adsense-id]" crossorigin="anonymous"></script>'; | |
} |
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 | |
/** | |
* Shortcode Extended | |
* | |
* @package ShortcodeExtended | |
* @author Chris Sparshott | |
* @copyright 2022 Chris Sparshott | |
* @license GPL-2.0-or-later | |
* |
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
Setting up my new Apple M1 macbook pro I was having issues setting up mysql@5.7 using homebrew, with the following message being thrown: | |
``` | |
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) | |
``` | |
We need to modify the MySQL config file: | |
``` | |
nano /usr/local/etc/my.cnf |
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 getTextNodes(cssSelector, findString) { | |
var items = $(cssSelector) | |
.contents() | |
.filter(function() { | |
var isText = this.nodeType == Node.TEXT_NODE; | |
if (isText) { | |
var text = $.trim(this.textContent); | |
if (text.length && text.indexOf(findString) > -1) { |