Skip to content

Instantly share code, notes, and snippets.

View willybahuaud's full-sized avatar

Willy Bahuaud willybahuaud

View GitHub Profile
@DevinWalker
DevinWalker / setup-phpunit.sh
Created May 26, 2017 20:46 — forked from keesiemeijer/setup-phpunit.sh
Setup PHPUnit for use in the Local by Flywheel app
#!/usr/bin/env bash
# ===============================================================================
# Script to install PHPUnit in the Local by Flywheel Mac app
# These packages are installed
#
# PHPUnit, git, subversion, composer, curl and wget
#
# WordPress and the WP_UnitTestCase are installed in the /tmp directory
# The $WP_CORE_DIR and $WP_TESTS_DIR variables are added to the .bashrc file
@thierrypigot
thierrypigot / tp_toolbox.php
Last active June 10, 2020 16:45
WordPress: Register taxonomy hack WordPress. In the register_taxonomy function, add : $args = array( 'meta_box_cb' => 'tp_taxonomy_radio_meta_box' );
<?php
/**
* Display taxonomy selection as radios
*
* @param WP_Post $post
* @param array $box
*/
if( !function_exists('wearewp_taxonomy_radio_meta_box') ) {
function wearewp_taxonomy_radio_meta_box($post, $box) {
@thierrypigot
thierrypigot / functions.php
Created April 25, 2016 08:18
Prevent Selected Terms Rising to the Top
<?php
add_filter('wp_terms_checklist_args','tp_wp_terms_checklist_args');
function tp_wp_terms_checklist_args($args) {
$args['checked_ontop'] = false;
return $args;
}
@thierrypigot
thierrypigot / admin-search-filter.php
Created November 19, 2014 17:11
Dans l'admin, étendre la recherche des Custom Post Type aux métas, en plus du titre et de la description.
<?php
/*
* Dans cet exemple mon Custom Post Type est "revendeurs"
*/
add_filter('posts_join', 'revendeurs_search_join' );
function revendeurs_search_join ($join){
global $pagenow, $wpdb;
// I want the filter only when performing a search on edit page of Custom Post Type named "revendeurs"
if ( is_admin() && $pagenow=='edit.php' && $_GET['post_type']=='revendeurs' && $_GET['s'] != '')