Skip to content

Instantly share code, notes, and snippets.

View basmiddelham's full-sized avatar

Bas Middelham basmiddelham

View GitHub Profile
@basmiddelham
basmiddelham / woocommerce-product-search.php
Created October 8, 2020 08:38
Custom Woocommerce product search
<?php
/**
* Custom Woocommerce product search
*/
add_filter( 'get_product_search_form', function ( $form ) {
$form ='<form role="search" method="get" class="woocommerce-product-search" action="' . esc_url( home_url( '/' ) ) . '">
<label class="screen-reader-text" for="woocommerce-product-search-field">' . esc_html__( 'Search for:', 'woocommerce' ) . '</label>
<div class="input-group">
<input type="search"
<?php
/**
* Disable WooCommerce default emails.
*/
add_action( 'woocommerce_email', function ( $email_class ) {
/**
* Hooks for sending emails during store events
**/
/* Newsletter form
* Single email field with submit button directly to the right
-------------------------------------------------------------- */
.gform_wrapper {
&.newsletter_wrapper {
.newsletter {
display: flex;
flex-wrap: wrap;
// Make header and validation span the form width
@basmiddelham
basmiddelham / widgets.scss
Last active December 17, 2019 19:53
Basic WordPress widget styling
/* Widgets
-------------------------------------------------------------- */
.widget {
.sidebar & {
margin-bottom: $grid-gutter-width;
font-size: $font-size-sm;
line-height: $line-height-sm;
// Display with columns on small screen
@include media-breakpoint-up(sm) {
/**
* Add class to menu-item
*/
add_filter('nav_menu_css_class', function ($classes, $item) {
$classes[] = 'nav-item';
return $classes;
}, 10, 2);
/**
* Add class to menu-link
@basmiddelham
basmiddelham / composer.json
Last active February 25, 2019 10:40
Default Composer Plugins
{
"name": "roots/bedrock",
"repositories": [
{
"type": "package",
"package": {
"name": "advanced-custom-fields/advanced-custom-fields-pro",
"version": "5.7.12",
"type": "wordpress-plugin",
"dist": {
@basmiddelham
basmiddelham / Cleanup_Admin_with_Intervention.php
Last active October 26, 2018 22:40
Cleanup Admin with Intervention
<?php
/**
* Cleanup and customize the admin with Intervention
* @link https://github.com/soberwp/intervention
*/
use function Sober\Intervention\intervention;
$title = 'Welcome to the ' . get_bloginfo('name') . ' Admin area';
$content = 'For support please contact <a href="https://ignation.io" target="_blank">Ignation</a>.<br>
@basmiddelham
basmiddelham / shortcode_ui.php
Last active November 5, 2018 17:43
Shortcode UI Button Example
<?php
/**
* If Shortcake isn't active, then add an administration notice.
*/
add_action('init', function () {
if (! function_exists('shortcode_ui_register_for_shortcode')) {
add_action('admin_notices', 'shortcake_notices');
}
});
@basmiddelham
basmiddelham / Basic_CPT_with_extended-cpts.php
Last active October 27, 2018 14:35
Basic Custom Post Type with extended-cpts
<?php
/**
* Custom Post Type with extended-cpts
* http://johnbillion.com/extended-cpts/
* https://github.com/johnbillion/extended-cpts
*/
add_action('init', function () {
register_extended_post_type('project', [
'has_archive' => false,
@basmiddelham
basmiddelham / _gallery.scss
Last active November 9, 2019 17:46
WP Gallery Bootstrap styling