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 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', |
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
<script> | |
( function() { | |
if ( typeof __tcfapi !== 'function' ) { | |
return; | |
} | |
__tcfapi( | |
'addEventListener', | |
2, | |
( tcData, success ) => { |
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
/** | |
* Import | |
*/ | |
class Import { | |
/** | |
* Construct | |
*/ | |
public function __construct() { | |
\add_action( 'init', [ $this, 'schedule_imports' ] ); |
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
## Find and replace ## | |
update wp_posts set post_content = | |
replace( post_content, '<h2 id="h-', '<h2 id="' ); | |
## Change metakey ## | |
UPDATE | |
wp_postmeta |
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
import { | |
__ | |
} from '@wordpress/i18n'; | |
import { | |
registerBlockType, | |
} from '@wordpress/blocks'; | |
import { | |
RichText, |
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
// Gutenberg Review | |
.is-style-review { | |
background: #fff3cd; | |
border-radius: 5px; | |
margin-top: 40px; | |
margin-bottom: 40px; | |
padding: 40px; | |
.wp-block-image { | |
img { |
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
/** | |
* 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; |
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
$page_id = get_the_ID(); | |
/* Tax query */ | |
$tax_query = array(); | |
if ( true ) { | |
$tax_query[] = array( | |
'taxonomy' => 'category', | |
'field' => 'slug', | |
'terms' => 'general', |
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
/** | |
* Select2 | |
*/ | |
$( '.pt-search' ).select2( { | |
minimumInputLength: 2, | |
placeholder: 'Search…', | |
ajax: { | |
url: 'http://somewebsite.com/wp-json/wp/v2/posts', | |
dataType: 'json', | |
data: function( params ) { |
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
/* 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'] ) |
NewerOlder