Skip to content

Instantly share code, notes, and snippets.

@NielsPilon
NielsPilon / madiba-cpt.php
Last active July 29, 2020 09:38
Custom Post example
/*Assortiment Custom Post Type*/
function madiba_custom_post_assortiment() {
$labels = array(
'name' => _x( 'Assortiment', 'post type general name' ),
'singular_name' => _x( 'Assortiment', 'post type singular name' ),
'add_new' => _x( 'Nieuwe bloem', 'crop' ),
'add_new_item' => __( 'Nieuwe bloem toevoegen' ),
'edit_item' => __( 'Wijzig bloem' ),
'new_item' => __( 'Nieuw item' ),
'all_items' => __( 'Alle bloemen' ),
@NielsPilon
NielsPilon / hide-wp-version.php
Created July 18, 2019 09:46
WordPress versie verbergen
function frisonline_remove_wp_version_strings( $src ) {
global $wp_version;
parse_str(parse_url($src, PHP_URL_QUERY), $query);
if ( !empty($query['ver']) && $query['ver'] === $wp_version ) {
$src = remove_query_arg('ver', $src);
}
return $src;
}
add_filter( 'script_loader_src', 'frisonline_remove_wp_version_strings' );
add_filter( 'style_loader_src', 'frisonline_remove_wp_version_strings' );
@NielsPilon
NielsPilon / rewriterule_htaccess
Last active July 18, 2019 09:22
Autohor RewriteRule .htaccess
RewriteRule ^author/username/ https://jouwwebsite.com/ [R=301,L]
@NielsPilon
NielsPilon / content-testimonial.php
Created November 29, 2018 13:08
ACF Gutenberg block
<?php
/**
* Block Name: Testimonial
*
* Het template bestand wat we gebruiken voor ons Testimonial block
*/
// afbeelding veld ophalen (array)
$avatar = get_field('afbeelding');
@NielsPilon
NielsPilon / functions.php
Last active November 29, 2018 13:11
ACF Gutenberg block render callback
<?php
function my_acf_block_render_callback( $block ) {
// convert name ("acf/testimonial") into path friendly slug ("testimonial")
$slug = str_replace('acf/', '', $block['name']);
// template bestand vanuit de "template-parts/block" map includen
if( file_exists(STYLESHEETPATH . "/blocks/content-{$slug}.php") ) {
include( STYLESHEETPATH . "/blocks/content-{$slug}.php" );
}
@NielsPilon
NielsPilon / functions.php
Last active November 29, 2018 13:11
Gutenberg block registreren
<?php
add_action('acf/init', 'my_acf_init');
function my_acf_init() {
// check of de functie bestaat
if( function_exists('acf_register_block') ) {
// Custom Testimonail block registrerend
acf_register_block(array(
@NielsPilon
NielsPilon / 0_reuse_code.js
Created August 4, 2016 08:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console