Skip to content

Instantly share code, notes, and snippets.

View bugnumber9's full-sized avatar

Nazar Hotsa bugnumber9

View GitHub Profile
<style>
body #load {
display: block;
height: 100%;
overflow: hidden;
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 9901;
@bugnumber9
bugnumber9 / form
Last active December 17, 2025 12:54
add_action( 'elementor_pro/forms/validation', function( $form_record, $ajax_handler ) {
if ( 'Test Form 1' !== $form_record->get_form_settings( 'form_name' ) ) {
return;
}
$fields = $form_record->get('fields');
$email = $fields['email']['value'];
if ( email_exists( $email ) ) {
@bugnumber9
bugnumber9 / get-random-email.php
Created September 2, 2023 09:49
FluentCRM - get email of a random contact from a given list
$contactApi = FluentCrmApi('contacts');
$listId = [1]; // ID of the list to pull contacts from
$ListContacts = $contactApi->getInstance()
->filterByLists($listId)
->get();
function getRandomEmail($contactsObject) {
// Get the items array from the object using a loop
$items = [];
foreach ($contactsObject as $contact) {
@bugnumber9
bugnumber9 / scroll-to-top.js
Created October 7, 2023 17:07
Elementor multistep form scroll to top on next step
(function ($) {
jQuery(window).on('elementor/frontend/init', function() {
if (elementorModules && elementorModules.frontend) {
class Custom_Steps_Top extends elementorModules.frontend.handlers.Base {
getDefaultSettings() {
return {
selectors: {
buttons: '.e-form__buttons',
form: '.elementor-form',
},
function has_class_single_title_container($content) {
return strpos($content, 'class="single-title-container"') !== false;
}
function replace_text($content){
if (is_single() && has_class_single_title_container($content)) {
$content = preg_replace_callback('/<h2(.*?)class="entry-title"(.*?)>(.*?)<\/h2>/', function($matches) {
return '<h1' . $matches[1] . 'class="entry-title"' . $matches[2] . '>' . $matches[3] . '</h1>';
}, $content);
}
return $content;
<?php
# composer require aws/aws-sdk-php
use Aws\SesV2\SesV2Client;
require 'vendor/autoload.php';
define('AWS_ACCESS_KEY_ID', '');
define('AWS_SECRET_ACCESS_KEY', '');
$client = new SesV2Client([
/**
* Add taxonomy to pages
*/
function bnn_add_pages_tax() {
register_taxonomy(
'page_category',
'page',
array(
'label' => __( 'Categories' ),
'rewrite' => array( 'slug' => 'page-category' ),
@bugnumber9
bugnumber9 / reset-option-id.sql
Last active June 1, 2025 10:01
Reset auto-increment for option_id in wp_options table
-- Step 1: Create a table backup so that you won't have to restore the whole DB if something goes goofy
CREATE TABLE wp_options_bak LIKE wp_options;
INSERT INTO wp_options_bak SELECT * FROM wp_options;
-- Step 2: Export data in the existing order, ordered by option_id
CREATE TABLE wp_options_tmp AS
SELECT option_name, option_value, autoload
FROM wp_options
ORDER BY option_id;
.iconbox-1 .elementor-icon {position: relative;}
.iconbox-1 .elementor-icon::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(to bottom right, #fff, #ff09ab);
@bugnumber9
bugnumber9 / form-preview.js
Created April 5, 2025 12:51
File preview for Elementor form upload field
document.addEventListener('DOMContentLoaded', function () {
const fileInput = document.querySelector('input[type="file"]');
const previewContainer = document.createElement('div');
fileInput.insertAdjacentElement('afterend', previewContainer);
fileInput.addEventListener('change', function (e) {
const file = e.target.files[0];
if (file) {