Skip to content

Instantly share code, notes, and snippets.

@welbinator
welbinator / release.yml
Created January 17, 2025 02:20
github release yml
name: Create Release
on:
workflow_dispatch:
inputs:
tag:
description: 'Release Tag'
required: true
jobs:
@welbinator
welbinator / gist:673b2c1c99883687321d7d194b2e074f
Last active February 8, 2024 02:05
redirect non-admins away from wp-admin
/**
* Hook into WordPress to check user capabilities before accessing wp-admin
*
* @return void
*/
function restrict_wp_admin() {
// Check if the current user is an administrator.
if ( ! current_user_can('administrator') && is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
// Redirect non-administrator users to the /my-account page.
wp_redirect( home_url( '/my-account' ) );
@welbinator
welbinator / functions.php
Last active December 14, 2021 03:21
[Orderable] Change "Contact Information" text on custom checkout page
<?php // <-- don't add this part, copy everything below this line
function change_shipping_text() { ?>
<script>
const checkout_text_contact = document.querySelector(".orderable-checkout-section--contact h3:first-of-type");
checkout_text_contact.innerHTML = "Kunde info";
const checkout_text_shipping = document.querySelector(".orderable-checkout-section--shipping h3:first-of-type");
checkout_text_shipping.innerHTML = "Leverings adresse";
</script>
<?php };
@welbinator
welbinator / functions.php
Created March 25, 2021 14:01
Change "No Upcoming Events" message
// change 'no upcoming events' message. filter found in /src/Tribe/Views/V2/Messages.php
add_filter( 'tribe_events_views_v2_messages_map', 'change_map_key', 10, 1);
function change_map_key( $map ) {
$map['no_upcoming_events'] = 'No events Bruh.';
return $map;
}
@welbinator
welbinator / functions.php
Created March 11, 2021 18:40
Disable tax for Event Ticket WooCommerce products
add_action( 'event_tickets_after_save_ticket', 'rt_disable_tax_for_event_tickets', 10, 4 );
function rt_disable_tax_for_event_tickets( $post_id, $ticket, $raw_data, $class_name ) {
//hardcoded for WooCommerce only
if ( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' != $class_name ) {
return;
}
$product = wc_get_product( $ticket->ID );
@welbinator
welbinator / gist:30f4762a43e26fb08f8a5ac82174042b
Last active January 11, 2022 17:43
limit to one ticket total
//
// limit customers to one overall ticket for an event
//
function limit_customers_to_one_ticket_total()
{
// bail if not on a Single Event page
if (!function_exists('tribe_is_event') || !tribe_is_event()) {
return false;
}
?>
@welbinator
welbinator / index.htm
Created May 22, 2017 16:32
Button Library
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML5 Herald</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">