Skip to content

Instantly share code, notes, and snippets.

@huubl
huubl / clinup
Created March 23, 2021 20:52 — forked from petskratt/clinup
Use wp-cli to clean up WordPress installs (force core & plugins reinstall, track changes in git allowing easy reverts etc)
#!/usr/bin/env bash
# for debug output, uncomment:
#set -x
function help {
echo "WordPress cleanup -v 0.5 2018-06-26 / [email protected]
Usage:
<x-layout>
<x-slot name="head">
<x-social-media-meta
title="Blade Component Examples"
description="Learn about all sorts of Blade component tips and tricks."
image="https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg"
card="summary"
/>
</x-slot>
@huubl
huubl / wp-search-filter-ajax.php
Created August 28, 2021 11:59 — forked from tradesouthwest/wp-search-filter-ajax.php
wordpress filter for searching categories with ajax
<form action="<?php echo site_url() ?>/wp-admin/admin-ajax.php" method="POST" id="filter">
<?php
if( $terms = get_terms( 'category', 'orderby=name' ) ) :
echo '<select name="categoryfilter"><option>Select category...</option>';
foreach ( $terms as $term ) :
echo '<option value="' . $term->term_id . '">' . $term->name . '</option>';
endforeach;
echo '</select>';
endif;
@huubl
huubl / class.php
Created November 1, 2021 09:45 — forked from igorbenic/class.php
How to create a Custom WooCommerce Email | https://www.ibenic.com/create-custom-woocommerce-email
<?php
/**
* Class Custom_WC_Email
*/
class Custom_WC_Email {
/**
* Custom_WC_Email constructor.
@huubl
huubl / functions.php
Created November 1, 2021 09:49 — forked from Jon007/functions.php
Add default Product Attributes to all WooCommerce products
/*
* Example adds certain named Product Attribute fields to the product Edit screen ready for completion.
* (Pre-requisite )
* This saves the Shop Admin having to add them manually.
*
* Why might you want to do this instead of adding Custom fields? There's plenty of nice documentation on adding custom fields
* for example: http://www.remicorson.com/mastering-woocommerce-products-custom-fields/
*
* Well a Product Attributes are a built in WooCommerce feature, using Terms which are a built in Wordpress feature.
* - no add-ons required
@huubl
huubl / ACFToArray.php
Created December 15, 2021 13:03 — forked from teolaz/ACFToArray.php
This class is an helpful method to add a caching layer to Advanced Custom Fields. This works adding a new row on database with the entire ACF data serialized for that saved post or option page, and then WITH A SINGLE QUERY done you can have all data back and ready to use.
<?php
/**
* Created by PhpStorm.
* User: Matteo
* Date: 04/07/2018
* Time: 12:52
*/
/**
* Class ACFToArray
@huubl
huubl / full-codes.js
Created January 31, 2022 16:21 — forked from markhowellsmead/full-codes.js
Extend core Gutenberg blocks with custom attributes and settings. View full tutorials here : https://jeffreycarandang.com/extending-gutenberg-core-blocks-with-custom-attributes-and-controls/
/**
* External Dependencies
*/
import classnames from 'classnames';
/**
* WordPress Dependencies
*/
const { __ } = wp.i18n;
const { addFilter } = wp.hooks;
@huubl
huubl / disable-acf-blocks-on-edit.js
Created March 8, 2022 10:09 — forked from derweili/disable-acf-blocks-on-edit.js
Disable Links in ACF Block-Edit Method
/*
* Wrap all ACF Blocks in Disabled block to disable all links in edit view
*/
const { createHigherOrderComponent } = wp.compose;
const { Fragment } = wp.element;
import { Disabled } from '@wordpress/components';
const withDisabledCompontent = createHigherOrderComponent( ( BlockEdit ) => {
return ( props ) => {
<?php
/*-----------------------------------------
REWRITE SEARCH URLS
-----------------------------------------*/
// Redirect ?s=xxx to /search/xxx
function redirect_search_url()
{
if (is_search() && !empty($_GET['s'])) {
wp_redirect(home_url('/' . _x('search' /* default search slug */, 'search url slug', THEME_TEXT_DOMAIN) . '/') . urlencode(get_query_var('s')));
@huubl
huubl / subtitle-extract.md
Created August 11, 2022 12:28 — forked from pavelbinar/extract-subtitles-from-mkv.md
Extract subtitles from .mkv files on Mac OS X

Extract Subtitles From .mkv

These instructions shall work on Mac OS X and Linux.

Install mkvtoolnix (Mac OS X)

Installation via Homebrew:

brew install mkvtoolnix