Skip to content

Instantly share code, notes, and snippets.

View yokada's full-sized avatar
🏠
Working from home

yokada yokada

🏠
Working from home
View GitHub Profile
@yokada
yokada / functions.php
Created January 5, 2020 20:37
In WordPress ACF, filter tree of taxonomy field_type
add_filter('acf/fields/taxonomy/wp_list_categories/name=mycat-tree1', 'mycat1_filter', 10, 2);
}
function mycat1_filter($args, $field) {
$cat = get_category_by_slug('mycat1-slug');
if (empty($cat)) {
return $args;
}
$args['parent'] = $cat->cat_ID;
return $args;
@yokada
yokada / col2idx.php
Created July 31, 2021 08:25
convert column name to index number
<?php
/**
* convert column name to index number.
*
* @param string $col 'Z', 'AA', 'ZAA'
*/
function col2idx($col = 'AZ') {
$idx = 0;
$k = count(range('A', 'Z'));