Skip to content

Instantly share code, notes, and snippets.

View bugnumber9's full-sized avatar

Nazar Hotsa bugnumber9

View GitHub Profile
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;
@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',
},
@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 / 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 ) ) {
<style>
body #load {
display: block;
height: 100%;
overflow: hidden;
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 9901;