Skip to content

Instantly share code, notes, and snippets.

function cmplz_pronamic_google_maps_script( $tags ) {
$tags[] = [
'name' => 'google-maps',
'category' => 'marketing',
'placeholder' => 'google-maps',
'urls' => [
'maps.googleapis.com/maps/api/js',
'pronamic-google-maps/js/site.'
],
'enable_placeholder' => '1',
<script>
( function() {
if ( typeof __tcfapi !== 'function' ) {
return;
}
__tcfapi(
'addEventListener',
2,
( tcData, success ) => {
/**
* Import
*/
class Import {
/**
* Construct
*/
public function __construct() {
\add_action( 'init', [ $this, 'schedule_imports' ] );
## Find and replace ##
update wp_posts set post_content =
replace( post_content, '<h2 id="h-', '<h2 id="' );
## Change metakey ##
UPDATE
wp_postmeta
import {
__
} from '@wordpress/i18n';
import {
registerBlockType,
} from '@wordpress/blocks';
import {
RichText,
// Gutenberg Review
.is-style-review {
background: #fff3cd;
border-radius: 5px;
margin-top: 40px;
margin-bottom: 40px;
padding: 40px;
.wp-block-image {
img {
/**
* Handle 404's
*/
function prefix_event_posts( $result = false, $wp_query ) {
if ( is_admin() ) {
return false;
}
if ( 'your_post_type_name' !== $wp_query->query['post_type'] ) {
return false;
$page_id = get_the_ID();
/* Tax query */
$tax_query = array();
if ( true ) {
$tax_query[] = array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => 'general',
/**
* Select2
*/
$( '.pt-search' ).select2( {
minimumInputLength: 2,
placeholder: 'Search…',
ajax: {
url: 'http://somewebsite.com/wp-json/wp/v2/posts',
dataType: 'json',
data: function( params ) {
/* Multiple select */
function prefix_settings_multiple_select( $args ) {
$selected_terms = get_option( $args['label_for'] );
$selected_terms = is_array( $selected_terms ) ? $selected_terms : array();
$selected_terms = array_map( 'absint', $selected_terms );
printf(
'<select name="%s" id="%s" multiple>',
esc_attr( $args['label_for'] . '[]' ),
esc_attr( $args['label_for'] )