Skip to content

Instantly share code, notes, and snippets.

View mehul0810's full-sized avatar
👋
Hey there! Let’s Connect

Mehul Gohil mehul0810

👋
Hey there! Let’s Connect
View GitHub Profile
@mehul0810
mehul0810 / wp_core_setup_local_by_flywheel.sh
Last active July 16, 2024 14:18
WordPress Core Development SetUp on Local by FlyWheel
#!/bin/bash
# Welcome to the WP Core Development Wizard.
#
# Author: Mehul Gohil
# Email: [email protected]
# Supports: Local 5.2.8. or later
#
# PreRequisites:
# 1. Install wget, subversion, curl, php5-cli, and git
<?php
$source_args = apply_filters( 'give_stripe_get_source_args', array(
'type' => 'card',
'token' => $token_id,
) );
$charge_options = array();
if ( give_is_stripe_connected() ) { // This ensures that stripe is connected using Connect API.
$charge_options['stripe_account'] = give_get_option( 'give_stripe_user_id' );
<?php
Stripe\Error\InvalidRequest Object
(
[message:protected] => Invalid token id: card_1CNHELLyXkL8xusLcSLH59hA
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => /app/public/wp-content/plugins/Give-Stripe/vendor/stripe/stripe-php/lib/ApiRequestor.php
[line:protected] => 124
[trace:Exception:private] => Array
(
<?php
/**
* Enqueue Inline Styles in WordPress.
*
* @author Mehul Gohil
* @link https://www.mehulgohil.in/code-snippets/enqueue-inline-styles/
*/
function mg_enqueue_inline_styles() {
$css = '';
<?php
/**
* This function will add new custom avatar to WordPress.
*
* @param array $avatars List of avatars in WordPress.
*
* @author Mehul Gohil
* @link https://www.mehulgohil.in/set-default-avatar/
*
* @return array
@mehul0810
mehul0810 / default-wordpress-blocks-sass.scss
Created January 23, 2019 10:46 — forked from davewarfel/default-wordpress-blocks-sass.scss
WordPress Blocks Styles - Cleaned Up, Commented & Sassified
/**
* WordPress Blocks
*
* Default block styling included with WordPress core.
* Provides a better starting point for WordPress theme developers,
* especially when using Sass.
*
* @link https://github.com/WordPress/WordPress/blob/master/wp-includes/css/dist/block-library/style.css
*
* Most styles from the above file are included.
<script type="text/javascript">
jQuery( 'document' ).ready( function ($) {
$('#billing_postcode').on( 'focusout', function() {
$(this).trigger('update_checkout');
});
});
</script>
<?php
function mg_update_order_review_on_checkout( $post_data ) {
@mehul0810
mehul0810 / register-payment-method-for-give.php
Last active January 10, 2020 03:49
This Gist is used to register custom payment gateway for Give.
<?php
/**
* Register payment method.
*
* @since 1.0.0
*
* @param array $gateways List of registered gateways.
*
* @return array
*/
<?php
function selfie_auction_disable_rocket_loader( $tag, $handle, $src ) {
if (
'jquery-ui-menu' === $handle ||
'jquery-ui-position' === $handle ||
'jquery-ui-core' === $handle ||
'jquery-ui-widget' === $handle ||
'jquery' === $handle
) {
$tag = str_replace( 'src=', 'data-cfasync="false" src=', $tag );
<?php
/**
* Pass custom field data to Stripe when payment is processed.
*
* Retrieves custom form field data from the $_POST variable and merges it into
* the array that is passed to Stripe when a payment is made. Custom field data
* can be found under Metadata in the Stripe payment details screen.
*
* @param array $charge_args Arguments passed to Stripe payment gateway.
*