This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('gform_field_validation', function($result, $value, $form, $field) { | |
// Specify the field IDs you want to restrict (example: 1, 2) | |
$restricted_field_ids = [1, 2]; | |
if (in_array($field->id, $restricted_field_ids)) { | |
// If value is an array (like Name field), convert it to a string | |
if (is_array($value)) { | |
$value = implode(' ', $value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function gw_required_placeholder_asterisk( $form ) { | |
foreach ( $form['fields'] as &$field ) { | |
// Skip fields that don't support placeholders | |
if ( ! is_callable( [ $field, 'get_entry_inputs' ] ) ) { | |
continue; | |
} | |
// Single input fields | |
if ( is_array( $field->inputs ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Use jQuery to replace product thumbnails with full-size images in admin | |
* @author: Faisal Ahammad | |
*/ | |
function replace_admin_thumbnails_with_fullsize_js() { | |
$screen = get_current_screen(); | |
if (!$screen || $screen->base !== 'edit' || $screen->post_type !== 'product') { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('woocommerce_package_rates', 'hide_shipping_when_free_is_available', 100); | |
function hide_shipping_when_free_is_available($rates) { | |
$free = array(); | |
// Find free shipping methods | |
foreach ($rates as $rate_id => $rate) { | |
if ('free_shipping' === $rate->method_id) { | |
$free[$rate_id] = $rate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wpb_disable_feed() { | |
wp_die( __('No feed available, please visit our <a href="' . | |
get_bloginfo('url') . '">homepage</a>!') ); | |
} | |
add_action('do_feed', 'wpb_disable_feed', 1); | |
add_action('do_feed_rdf', 'wpb_disable_feed', 1); | |
add_action('do_feed_rss', 'wpb_disable_feed', 1); | |
add_action('do_feed_rss2', 'wpb_disable_feed', 1); | |
add_action('do_feed_atom', 'wpb_disable_feed', 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Disable Admin Notices WordPress | |
* Description: Completely removes all admin notices from the WordPress dashboard, | |
* including core WordPress notices and those added by plugins and themes. | |
* @author Faisal Ahammad <[email protected]> | |
*/ | |
// Exit if accessed directly | |
if (!defined('ABSPATH')) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Ninja Forms - Disable Past Dates and Sundays in Advanced Datepicker | |
* @author Faisal Ahammad | |
*/ | |
jQuery(document).ready(function ($) { | |
function initCustomDatePicker() { | |
var customDatePicker = Marionette.Object.extend({ | |
initialize: function () { | |
this.listenTo(Backbone.Radio.channel("flatpickr"), "init", this.modifyDatepicker); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove thousand separator from WordPress pagination | |
* @author Faisal Ahammad | |
*/ | |
/** | |
* @param $output | |
* @return mixed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* WooCommerce Merge Email and Phone on Checkout | |
* @author Faisal Ahammad | |
*/ | |
add_filter( 'woocommerce_checkout_fields', 'customize_checkout_fields_checkout' ); | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Woocommerce Add Phone Number To Login Account | |
* @author Faisal Ahammad | |
*/ | |
// Enable login with phone number or email | |
add_filter( 'authenticate', 'login_with_phone_or_email', 20, 3 ); |
NewerOlder