Skip to content

Instantly share code, notes, and snippets.

View DevlopersField's full-sized avatar

Viraj Chaudhary DevlopersField

View GitHub Profile
@DevlopersField
DevlopersField / wordpress-author-slug.md
Created February 19, 2025 07:53
wordpress author slug custom author slug

To remove Author "/author/" from slug

 add_filter('author_rewrite_rules', 'no_author_base_rewrite_rules');
function no_author_base_rewrite_rules($author_rewrite) { 
    global $wpdb;
    $author_rewrite = array();
    $authors = $wpdb->get_results("SELECT user_nicename AS nicename from $wpdb->users");    
    foreach($authors as $author) {
        $author_rewrite["({$author->nicename})/page/?([0-9]+)/?$"] = 'index.php?author_name=$matches[1]&paged=$matches[2]';
 $author_rewrite["({$author->nicename})/?$"] = 'index.php?author_name=$matches[1]';
@DevlopersField
DevlopersField / UB_sticky_header.html
Created January 29, 2025 08:00
Unbounce sticky header after some scrool
<style>
/* Update #lp-pom-box-53 with the ID of your landing page's box element. */
/* #lp-pom-box-509, #lp-pom-box-509-color-overlay {display: none;} */
</style>
<script>
//Fading Fixed Menu, modified from Fixed Menu v1.3.1
//Replace ID below with your own box ID
var boxToAppend = '#lp-pom-box-509';
//Choose pixel height of when menu fades in. Use the height of a page section like this: $("#lp-pom-block-93").height();
@DevlopersField
DevlopersField / Custom-Blog-posts.php
Created January 7, 2025 02:19
Custom Blog posts in function file wordpress
/* Change Blog URL */function custom_blog_permalink_structure($post_link, $post) {
if (is_object($post) && $post->post_type == 'post') {
return home_url('/blog/' . $post->post_name . '/');
}
return $post_link;
}
add_filter('post_type_link', 'custom_blog_permalink_structure', 10, 2);
function custom_blog_rewrite_rules($rules) {
$new_rules = array(
@DevlopersField
DevlopersField / gh-dynamic-month.html
Created October 25, 2024 01:41
GHL Dynamic month using js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
@DevlopersField
DevlopersField / acf-custom-block.md
Last active September 19, 2024 02:50
custom acf pro block gutenburge

Step 1: Install ACF Pro

Ensure ACF Pro version 6.0.0 or above is installed and activated on your WordPress site.

Step 1 A : Create Custom Block Category

// custom block category
function custom_block_category($categories)
{
    return array_merge(
        $categories,
@DevlopersField
DevlopersField / ub_exclude_free_email+provide.html
Last active August 1, 2024 11:57
unbounce regex for only work emails and exclude free domain providers
^(?!.*@(gmail\.com|yahoo\.com|hotmail\.com|live\.com|outlook\.com|protonmail\.com|zoho\.com|icloud\.com|aol\.com|gmx\.com|mail\.com|yandex\.com|tutanota\.com|fastmail\.com|neo\.com|googleworkspace\.com|posteo\.de|tuta\.io|mailbox\.org|rediffmail\.com|test\.com)$)[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9_\-]+\.[a-zA-Z0-9\-.]{2,61}$
<!-- exclude free mail with all alphabet -->
^(?!.*@(gmail\..*|yahoo\..*|hotmail\..*|live\..*|outlook\..*|protonmail\..*|zoho\..*|icloud\..*|aol\..*|gmx\..*|mail\..*|yandex\..*|tutanota\..*|fastmail\..*|neo\..*|googleworkspace\..*|posteo\..*|tuta\..*|mailbox\..*|rediffmail\..*|test\..*)$)[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9_\-]+\.[a-zA-Z0-9\-.]{2,61}$
@DevlopersField
DevlopersField / geolocation.md
Created July 10, 2024 06:15
how to use geolocation for unbounce or anyother pages using third party sites
@DevlopersField
DevlopersField / ub-light-box-triger.html
Created June 28, 2024 11:47
unbounce lightbox triger from slider using js
**create buttons like lp-pom-button-202 **
<script>
document.addEventListener('DOMContentLoaded', function () {
const mappings = {
'vid-1': 'lp-pom-button-202',
'vid-2': 'lp-pom-button-203',
'vid-3': 'lp-pom-button-208',
'vid-4': 'lp-pom-button-209',
'vid-5': 'lp-pom-button-212'
@DevlopersField
DevlopersField / form-validation.alphabet.numberic.html
Created June 28, 2024 04:17
Form validating like alphabets , number or number in range for form even cant type on form
<!-- validation to type -->
<script>
// Function to allow only alphabetic input
function allowOnlyAlphabets(event) {
event.target.value = event.target.value.replace(/[^a-zA-Z]/g, '');
}
// Function to allow only numeric input
function allowOnlyNumbers(event) {
event.target.value = event.target.value.replace(/[^0-9]/g, '');
@DevlopersField
DevlopersField / unbouncepass-parameters.md
Last active May 24, 2024 08:37
Append custom form field in unbounce using Utm params sometime we have to pass value for custom questions like directly to Calendly for example a1,a2,a3

Today, we encountered an issue with passing values to Calendly from Unbounce. Specifically, we need to pre-populate invitee information on the scheduling page using URL parameters.

For custom questions like phone number, website, etc., the values should be passed as query parameters, such as ?a1=xxxx&a2=xxxx. Solution:

To pass a phone number as a1, follow these steps:

Create a hidden field with the name a1.

Use the following script to pass the phone number value to the hidden field before form submission: