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
/** | |
* Elementor Device Preview Sizes | |
* | |
* @return void | |
*/ | |
function add_custom_elementor_editor_css() { | |
if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) { | |
echo '<style> | |
/* iPhone 14 – smallest viewport the responsive preview can be */ |
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 | |
/** | |
* Elementor Conditions based on Page Template | |
* | |
* @return void | |
*/ | |
add_action( 'elementor/theme/register_conditions', function( $conditions_manager ) { | |
class Page_Template_Condition extends ElementorPro\Modules\ThemeBuilder\Conditions\Condition_Base { |
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 | |
/** | |
* Responsive Preview WP Codebox | |
* | |
* @return void | |
*/ | |
add_action("admin_head", "add_responsive_buttons_to_wpcodebox"); | |
function add_responsive_buttons_to_wpcodebox() | |
{ |
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 | |
/* Source: https://quadlayers.com/change-order-status-automatically-in-woocommerce/ */ | |
function user_role_order_status( $order_id ) { | |
if ( ! $order_id ) { return; } | |
$order = wc_get_order( $order_id ); | |
// Change db prefix `wp_` of `wp_capabilities`, if required | |
$usermeta = get_user_meta( get_current_user_id(),'wp_capabilities', true ); | |
// Enter the user role name to apply this function to |
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 | |
// Convert Mobile to tel link | |
add_filter('acf/format_value/name=ACF_MOBILE_FIELD_NAME', 'convert_phone_to_link', 20, 3); | |
function convert_phone_to_link ($value, $post_id, $field) { | |
if (!$value) { | |
return $value; | |
} | |
$tel_link = preg_replace('/[^0-9]/', '', $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 | |
/* | |
* Allow Jet Smart Filters to show published posts | |
*/ | |
add_action( 'elementor/query/jet-smart-filters', function( $query ) { | |
// Add `jet-smart-filters` to `Query ID` of `Post` widget | |
$query->set( 'post_status', [ 'publish' ] ); | |
} ); | |
?> |
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
/* ------------------------------------ | |
/* CUSTOM FONTS | |
/* ------------------------------------ */ | |
/* ELEMENTOR */ | |
function modify_controls( $controls_registry ) { | |
// First we get the fonts setting of the font control | |
$fonts = $controls_registry->get_control( 'font' )->get_settings( 'options' ); | |
// Then we append the custom font family in the list of the fonts we retrieved in the previous step | |
$new_fonts = array_merge( [ 'Biotif' => 'system' ], $fonts ); |
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 | |
/** | |
* Elementor Custom Fonts | |
* Source: https://merianos.wordpress.com/2017/09/22/elementor-register-custom-font-family-in-the-fonts-control/ | |
*/ | |
function modify_controls( $controls_registry ) { | |
// First we get the fonts setting of the font control | |
$fonts = $controls_registry->get_control( 'font' )->get_settings( 'options' ); | |
// Then we append the custom font family in the list of the fonts we retrieved in the previous step |
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
/* REMOVE COD FOR USER ROLE STOCKIST */ | |
add_filter( 'woocommerce_available_payment_gateways', 'sow_checkout_restrictions', 10, 1 ); | |
function sow_checkout_restrictions( $available_gateways ) { | |
global $woocommerce; | |
if (!empty(current_user_can('stockist') )) { | |
unset( $available_gateways['cod'] ); |
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 | |
/* Free shipping for non-stockists | |
* Adapted from Sean Barton's snippet | |
* http://www.sean-barton.co.uk/2014/04/wordpress-snippet-woocommerce-free-shipping-role/#.VW_FaVyqpBc | |
* Click "Clear transients" (WooCommerce > System Status > Tools) if it's not working. | |
*/ | |
add_filter( 'woocommerce_package_rates', 'my_woocommerce_set_free_shipping_for_certain_users', 10, 1); |
NewerOlder