Skip to content

Instantly share code, notes, and snippets.

View Drivingralle's full-sized avatar

Ralf Wiechers Drivingralle

View GitHub Profile
@adrianduffell
adrianduffell / functions.php
Created June 19, 2024 00:01
Exclude user role from coming soon protection
<?php
add_filter( ‘woocommerce_coming_soon_exclude’, function( $is_excluded ) {
$current_user = wp_get_current_user();
$role_to_exclude = ‘name_of_role’;
if ( in_array( $role_to_exclude, (array) $current_user->roles ) ) {
return true;
}
@hofmannsven
hofmannsven / editor.css
Last active April 7, 2022 16:34
WordPress block editor spacer block placeholder styles.
.block-editor .wp-block-spacer {
border: 2px dashed #cbd5e1;
background-color: #f1f5f9;
}
@goaround
goaround / taxonomy-wp-rest-search.php
Created June 12, 2020 14:51
WordPress Plugin: Taxonomy WP REST Search for the WordPress Block Editor (Gutenberg)
<?php
/**
* Plugin Name: Taxonomy WP REST Search
* Plugin URI:
* Description: Taxonomy WP REST Search for the WordPress Block Editor (Gutenberg)
* Author: Johannes Kinast <johannes@travel-dealz.de>
* Author URI: https://go-around.de
* Version: 1.0.0
*/
namespace Taxonomy_WP_REST_Search;
@felixarntz
felixarntz / wp-plugin-mu-loader.php
Last active October 10, 2022 12:21
WP Plugin MU Loader
<?php
/**
* Plugin initialization file
*
* @package WP_Plugin_MU_Loader
* @since 1.0.0
*
* @wordpress-plugin
* Plugin Name: WP Plugin MU Loader
* Plugin URI: https://gist.github.com/felixarntz/daff4006112b60dfea677ca08fc0b31c
@Drivingralle
Drivingralle / decline-booking-row-action.php
Last active January 18, 2023 15:49
Add row/booking action button to decline a woocomerce booking
/*
* Add decline button to list view of woocommerce bookings
*/
function wocommerce_bookings_mods_add_custom_booking_status_button_to_bookings_list( $actions, $booking ) {
// Check if the booking requires a decision
if ( 'pending-confirmation' === $booking->get_status() ) {
// Add button to decline the booking
$actions['decline'] = array(
<?php
/**
* Plugin Name: Cross Media Cloud | Add language slug to blog name in admin bar
* Description: Show the blog language within the drop down of sites within the admin bar
* Version: 1.0
* Author: Cross Media Cloud
* Author URI: https://www.cross-media-cloud.de
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@Drivingralle
Drivingralle / enqueue-styles-with-right-version.php
Created December 1, 2016 15:06
WordPress | Enqueue scripts/styles automaticly using right version number from parent-/child-theme
<?php
/*
* Enqueue parent and child theme style.css
*/
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles', 20 );
function my_theme_enqueue_styles() {
// Get the theme data
$my_theme = wp_get_theme();
@hlashbrooke
hlashbrooke / functions.php
Last active May 26, 2020 01:03
WordPress: Create a custom metabox that works in exactly the same way as the existing 'Featured Image' box on the post edit screen. In this case the image is called 'Listing Image' (with all the function and variable names correlating to that), but you can change the strings to whatever you need them to be.
<?php
add_action( 'add_meta_boxes', 'listing_image_add_metabox' );
function listing_image_add_metabox () {
add_meta_box( 'listingimagediv', __( 'Listing Image', 'text-domain' ), 'listing_image_metabox', 'post', 'side', 'low');
}
function listing_image_metabox ( $post ) {
global $content_width, $_wp_additional_image_sizes;
$image_id = get_post_meta( $post->ID, '_listing_image_id', true );
@johnbillion
johnbillion / wp_mail.md
Last active June 3, 2024 13:31
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here: https://github.com/johnbillion/wp_mail

@Zodiac1978
Zodiac1978 / wp-config.php
Last active July 22, 2016 09:07
Interesting things for your wp-config.php
// Disabling the plugin and theme editor for more security
define('DISALLOW_FILE_EDIT', true);
// Check for a local config file
if ( file_exists( dirname( __FILE__ ) . '/wp-local-config.php' ) ) {
/* Get the settings for the development site */
include( dirname( __FILE__ ) . '/wp-local-config.php' );
} else {
// Settings for live site