Skip to content

Instantly share code, notes, and snippets.

View dexit's full-sized avatar
🎯
Focusing

Rihards Mantejs dexit

🎯
Focusing
View GitHub Profile
@dexit
dexit / elementor_email_validation.php
Created November 15, 2024 14:56 — forked from adriannees/elementor_email_validation.php
Elementor Form Email Validation
// Validate confirmation email ref (https://github.com/elementor/elementor/issues/8684)
add_action( 'elementor_pro/forms/validation', function ( $record, $ajax_handler ) {
// Create variables representing the field ids of the fields
$first_email_field = $record->get_field( ['id' => 'email'] ); // Field ID (Advanced tab) is "email"
$second_email_field = $record->get_field( ['id' => 'email_confirm'] ); // Field ID (Advanced tab) is "email_confirm"
if ( property_exists( $second_email_field ) ) {
@dexit
dexit / val.php
Created November 15, 2024 14:56 — forked from mhazgui/val.php
Elementor form validation
// Validate password form
add_action('elementor_pro/forms/validation', function ( $record, $ajax_handler ) {
//make sure its our form
$form_name = $record->get_form_settings( 'form_name' );
// Replace MY_FORM_NAME with the name you gave your form
if ( 'Sign-up' !== $form_name ) {
return;
}
@dexit
dexit / sign-up-elementor-form.php
Created November 15, 2024 14:48 — forked from giacomolanzi/sign-up-elementor-form.php
Pass Elementor Form data to the function to create a new user in WP.
<?php
add_action( 'elementor_pro/forms/new_record', 'planbproject_elementor_form_create_new_user' , 10, 2 );
function planbproject_elementor_form_create_new_user($record,$ajax_handler) // creating function
{
$form_name = $record->get_form_settings('form_name');
//Check that the form is the "Sign Up" if not - stop and return;
if ('Sign Up' !== $form_name) { // Add form name
return;
}
@dexit
dexit / .php
Created November 15, 2024 14:48 — forked from mvazquezmultimedia/.php
add_action( 'elementor_pro/forms/validation/email', function( $field, $record, $ajax_handler ) {
// Get submitted form data.
$raw_fields = $record->get( 'fields' );
foreach ( $raw_fields as $id => $field ) {
$fields[ $id ] = $field['value'];
if ($field[ 'id' ] == 'FirstName'){
$FirstName = $field[ 'value' ];
}
@dexit
dexit / elementor.php
Created November 15, 2024 14:48 — forked from vicctim/elementor.php
[WordPress] Formulário de contato Elementor com envio de API WhatsApp
<? add_action( 'elementor_pro/forms/new_record', function( $record, $handler ) {
//Setar o form_name
$form_name = $record->get_form_settings( 'form_name' );
//Definir o formulário
if ( 'contato' !== $form_name ) {
return;
}
<?php
/**
* Theme functions and definitions.
*
* For additional information on potential customization options,
* read the developers' documentation:
*
* https://developers.elementor.com/docs/hello-elementor-theme/
*
* @package HelloElementorChild
@dexit
dexit / theme.json
Created November 15, 2024 12:25 — forked from emre-edu-tech/theme.json
Wordpress Full Site Editor theme.json sample file with a Visual Studio Code Schema - Theme Prefix is mpons
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 2,
"settings": {
"typography": {
"fontFamilies": [
{ "fontFamily": "Rubik, sans-serif", "slug": "mpons-rubik", "name": "Mpons Rubik" }
],
"fontSizes": [
{ "slug": "small", "size": "0.75rem", "name": "Small" },
@dexit
dexit / simple-wp-theme-screenshot-generator.php
Created November 15, 2024 12:25 — forked from emre-edu-tech/simple-wp-theme-screenshot-generator.php
Creating a theme screenshot.png file for Wordpress Theme Development.
<?php
// Check if GD is installed
if (!extension_loaded('gd')) {
die("GD library is not installed. Please enable it in your PHP configuration.");
}
// Set image dimensions and properties
$width = 1200;
$height = 900;
$backgroundColor = [240, 240, 240]; // Light gray background
@dexit
dexit / functions.php
Created November 15, 2024 12:24 — forked from emre-edu-tech/functions.php
Elementor Custom Query Filter using New Search Widget. Search widget supports ajax hitting the Rest Endpoint
<?php
// Here we use tax query but meta_query is also possible
// Unfortunately, there is no way to merge Wordpress default search behaviour, meta_query and tax_query using OR
// that I could find.
// Default behaviour for merging these queries are AND.
// Custom Elementor Query for Search
function mpons_custom_property_search_query($query) {
// Get the search term from the WP_Query object
$search_term = $query->get('s');
@dexit
dexit / functions.php
Created November 15, 2024 12:23 — forked from emre-edu-tech/functions.php
Elementor Pro Form Prepopulate Select Field in two forms (One on a page and one on a popup)
<?php
// render elementor forms select item for year_built in Angebotsanfrage form
// rerender the select field using elementor form api
add_filter('elementor_pro/forms/render/item/select', function($item, $index, $form) {
if('vehicle_quote_form' === $form->get_settings_for_display('form_name') || 'vehicle_quote_form_popup' === $form->get_settings_for_display('form_name')) {
if('year_built' == $item['custom_id'] || 'year_built_popup' == $item['custom_id']) {
$item['field_options'] = "Bitte Jahr auswählen|\n";
for($year=date('Y'); $year >= 1970; $year--) {
if($year != 1970) {
$item['field_options'] .= $year . "|" . $year . "\n";