Skip to content

Instantly share code, notes, and snippets.

View safwanafridi's full-sized avatar

Safwan Afridi safwanafridi

  • Pakistan
View GitHub Profile
@safwanafridi
safwanafridi / Instructions.txt
Created April 16, 2024 10:39
How to display Most Searched Keywords below Search Bar in WordPress Website - Free method to add this functionality without using the Paid Plugin
Watch this Video (Language: Urdu) = https://www.linkedin.com/posts/safwanafridi_wordpress-wordpresscommunity-wordpresstips-activity-7185940917751586816-QHoC
@safwanafridi
safwanafridi / AdditinFunctionsfile.txt
Last active January 23, 2024 07:47
Code for (Shortcode Creation and Extracting MetaKey Value from Post) | Add this code to function.php file of your WordPress theme
function shortcode_listing_expiry() {
// Get the current post ID
$post_id = get_the_ID();
// Get the _expiry_date meta value for the current post
$expiry_date = get_post_meta($post_id, '_expiry_date', true);
// Output the meta value
if (!empty($expiry_date)) {
$output = '<p>Expiry Date: ' . esc_html($expiry_date) . '</p>';
@safwanafridi
safwanafridi / open-elementorpopup-using-js.js
Last active February 8, 2024 08:58
Open Elementor Popup using Javascript (Solution for showing 2nd elementor popup which is not opening on the page due to confliction )- In this senario popup will show when wpform is submitted and confimation message show up on page. You can change the trigger according to your need. You can add this code in the html block inside the elementor ed…
<script>
var Status = true;
var observer;
var config;
function runCodeWhenElementExists() {
setTimeout(() => {
// Check if the target element exists
if (document.querySelector("#wpforms-confirmation-2690") && Status) {
@safwanafridi
safwanafridi / Prepopulate-calendlyform-from-wpforms.js
Last active November 25, 2023 07:20
This JavaScript code snippet serves the purpose of pre-populating Calendly form fields embedded on a WordPress Website through WpForms. When a user submits the form, the script dynamically fetches customized data set in the WpForms Confirmation Message. Subsequently, it updates the iframe src code using JavaScript, ensuring a seamless integratio…
< script >
document.addEventListener('DOMContentLoaded', function() {
var wpformsSubmitBtn = document.querySelector('.calendlypopup');
// Run the code after 1.5 second when Submit button is clicked in WpForm.
wpformsSubmitBtn.addEventListener('click', function() {
setTimeout(function() {
// Get the current src attribute of the iframe
var iframe = document.querySelector('.calendly-inline-widget iframe');