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 | |
/** | |
* Plugin Name: Elementor Conditions for Elements | |
* Description: A plugin to add custom display conditions | |
* Plugin URI: https://elementor.com/ | |
* Version: 1.0.0 | |
* Author: Phil Ingram | |
* Author URI: https://developers.elementor.com/ | |
* Text Domain: elementor-conditions | |
* |
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
/** | |
* Checks form textarea content is english to reduce spam from non-english bots | |
**/ | |
function elementor_form_message_field_validation( $field, $record, $ajax_handler ) { | |
// Let's check the message field only | |
if ( empty( $field ) || empty( $field['message'] ) ) { | |
return; | |
} | |
// Validate content format by language | |
$string = $field['message']; |
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
//set the email address | |
$email = 'your@ema.il'; | |
//get orders using the customer email address | |
$query = new WC_Order_Query(); | |
$query->set( 'customer', $email ); | |
$query->set( 'limit', -1 ); | |
$orders = $query->get_orders(); | |
//check if not a WordPress user but orders do exist |
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 | |
/** | |
* Removes header & footer when editing Elementor Section templates | |
* | |
* Action: adds inline css to hide elements | |
* | |
* see Elementor issue: https://github.com/elementor/elementor/issues/6297 | |
* | |
* How to use: add this file to your child theme and include it in your functions.php adding: | |
* include_once( 'is-section-template.php' ); |
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 | |
/** | |
* Adds Render control to all widgets | |
* | |
* Action: toggle | |
* | |
* (base for adding custom conditions, see Step 3) | |
* | |
**/ |
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
// check_webp_feature: | |
// 'feature' can be one of 'lossy', 'lossless', 'alpha' or 'animation'. | |
// 'callback(feature, isSupported)' will be passed back the detection result (in an asynchronous way!) | |
// see: https://stackoverflow.com/a/54631141/4845112 | |
function check_webp_feature(feature, callback) { | |
var kTestImages = { | |
lossy: "UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", | |
lossless: "UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==", | |
alpha: "UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==", | |
animation: "UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA" |
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
/** | |
* perf monitoring | |
* use: | |
* const end = Date.now(); | |
* const elapsed = end - start; // elapsed time in milliseconds | |
********************/ | |
const start = Date.now(); | |
//do stuff when Elementor initializes | |
window.addEventListener('elementor/frontend/init', function() { |
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 | |
/** | |
* Twilio Elementor Pro form integration | |
* requirements: | |
* - php7.2 or greater | |
* - twilio php helper library - https://github.com/twilio/twilio-php/archive/main.zip | |
* - copy into theme folder /twilio and ref below on init | |
*/ |
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 | |
/** | |
* Modify Elementor Column to wrap an anchor tag around it without actually wrapping it (overlay method) | |
* | |
* 1) Add url controls to column for loading w/ a link | |
* | |
* 2) Use 'elementor/frontend/column/before_render' action hook to update the column's | |
* css class and output the anchor tag (link) on the front end | |
* | |
* 3) Load needed css to document header - conditionally, only if any column(s) has link(s) |
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
/** | |
* Modify Spacer Widget to wrap an anchor tag around it | |
* | |
* 1) Add url control to spacer widget for loading w/ a link | |
* | |
* 2) Use 'elementor/widget/render_content' action hook to update the spacer widget's | |
* normal output on the front end | |
* | |
**/ | |
//part 1. to add our url control |
NewerOlder