Skip to content

Instantly share code, notes, and snippets.

Avatar

harkor

View GitHub Profile
@harkor
harkor / fixCategorySlugForLanguages.php
Created Aug 6, 2021
Fix 404 error WPML - Slug with %custom_taxonomy% in rewrite slug
View fixCategorySlugForLanguages.php
/**
* To make it work you need :
* 1 - Set a translation in WPML for the custom post type
* 2 - flush permalinks
*/
// Example custom post type snippet
add_action('init', function(){
// Register Custom Post type
@harkor
harkor / rwmb-copy-group.js
Created Apr 8, 2021
Copy Button for groups Metabox
View rwmb-copy-group.js
jQuery(function($){
setTimeout(function(){
$('.rwmb-clone').each(function(){
var $this = $(this);
$this.prepend('<a href="#" class="rwmb-button copy-clone"><span class="dashicons dashicons-controls-repeat"></span></a>');
});
}, 500);
});
( function( $, _, document, window, rwmb, i18n ) {
@harkor
harkor / MetaBoxClass.php
Created Feb 25, 2021
MetaBox Select Advanced Ajax
View MetaBoxClass.php
<?php
class MetaBoxClass {
function __construct(){
// Set MetaBox
add_filter('rwmb_meta_boxes', array(&$this, 'my_meta_box'));
// Add new field type
View MyMetaBox-fix2.php
<?php
class MyMetaBox {
function __construct(){
add_filter('rwmb_meta_boxes', array(&$this, 'my_meta_box'));
}
View MyMetaBox-fix.php
<?php
class MyMetaBox {
function __construct(){
add_filter('rwmb_meta_boxes', array(&$this, 'my_meta_box'));
add_action('wp_ajax_get_options', array(&$this, 'get_options'));
}
View MyMetaBox.php
<?php
class MyMetaBox {
function __construct(){
add_filter('rwmb_meta_boxes', array(&$this, 'my_meta_box'));
add_action('wp_ajax_get_options', array(&$this, 'get_options'));
}
View vagrant halt
__ __ __ __
\ V\ V\ V / Varying Vagrant Vagrants
\_/\_/\_/ v2.4.0-git::master
Platform: linux-gnu shell:/bin/zshsystemd CaseSensitiveFS
Vagrant: 2.2.2
VirtualBox: 5.2.22r126257
Docs: https://varyingvagrantvagrants.org/
Contribute: https://github.com/varying-vagrant-vagrants/vvv