Skip to content

Instantly share code, notes, and snippets.

View dexit's full-sized avatar
🎯
Focusing

Rihards Mantejs dexit

🎯
Focusing
View GitHub Profile
@hansschuijff
hansschuijff / plugin.php
Created December 4, 2023 21:29 — forked from kovshenin/plugin.php
Settings API Demo
<?php
/**
* Plugin Name: My Plugin
* Plugin Description: Settings API Demo
*/
add_action( 'admin_menu', 'my_admin_menu' );
function my_admin_menu() {
add_options_page( 'My Plugin', 'My Plugin', 'manage_options', 'my-plugin', 'my_options_page' );
}
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/@ungap/custom-elements-builtin"></script>
<script type="module" src="https://unpkg.com/x-frame-bypass"></script>
</head>
<body>
<iframe is="x-frame-bypass" name='NewIframe' height='800px' width='100%' scrolling='yes' src='https://calendar.google.com/calendar/r' marginwidth='0px' marginheight='0px' frameborder='1' id='myFrame' allowfullscreen style='border:0px none #ffffff'></iframe>
</body>
</html>
@dexit
dexit / mywoobaseline.php
Last active December 16, 2024 16:23
WooMustHaves
<?php
/**
* @snippet Add First & Last Name to My Account Register Form - WooCommerce
* @author Rodolfo Melogli
* @compatible WC 3.9
*/
///////////////////////////////
// 1. ADD FIELDS
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
class ProcessHubSpotController extends Controller
{
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
class ProcessHubSpotController extends Controller
{
/*
*
* ------WebKitFormBoundaryuVJ3SdmBDIE5e9iy
@dexit
dexit / functions.php
Created September 11, 2023 07:52 — forked from maddisondesigns/functions.php
Better WordPress is_admin()
<?php
/**
* Check if inside WP Admin. Also works in the Block Editor.
*
* With the introduction of Gutenberg, is_admin() was broken.
* This better version will account for the Block Editor (Gutenberg)
*/
function mytheme_better_is_admin() {
// Check if in Block Editor - see: https://github.com/WordPress/gutenberg/issues/51090#issuecomment-1576570247
if ( is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST && 'edit' === $_GET['context'] ) ) {
@thisissandip
thisissandip / class-wc-bookings-create.php
Created September 4, 2023 14:27
Modified class-wc-bookings-create.php - it saves the manually created order after adding the item meta
<?php
/**
* Create new bookings page.
*/
class WC_Bookings_Create {
/**
* Stores errors.
*
* @var array
@dexit
dexit / elementor_pro_form_woocommerce_submit_save.php
Created August 30, 2023 14:11
Stores Elementor Pro Form submissions into the WooCommerce session.
<?php
add_action( 'elementor_pro/forms/validation', function( $record, $ajax_handler ) {
// Require WooCommerce
if( ! class_exists( 'WooCommerce' ) || empty( WC()->session ) ) {
return;
}
// Boot Cart Session
if( ! WC()->session->has_session() ) {
@dexit
dexit / wc_bookings_is_bookeable_product.php
Created August 7, 2023 14:33 — forked from kadimi/wc_bookings_is_bookeable_product.php
WooCommere Bookings - Check if current page is a bookable product
<?php
/**
* WooCommere Bookings - Check if current page is a bookable product.
* @return boolean True for bookable products, false otherwise
*/
function is_bookable_product() {
return is_product() && wc_get_product() instanceof WC_Product_Booking;
}
@maddisondesigns
maddisondesigns / functions.php
Last active September 11, 2023 07:52
Better WordPress is_admin()
<?php
/**
* Check if inside WP Admin. Also works in the Block Editor.
*
* With the introduction of Gutenberg, is_admin() was broken.
* This better version will account for the Block Editor (Gutenberg)
*/
function mytheme_better_is_admin() {
// Check if in Block Editor - see: https://github.com/WordPress/gutenberg/issues/51090#issuecomment-1576570247
if ( is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST && 'edit' === $_GET['context'] ) ) {