Skip to content

Instantly share code, notes, and snippets.

View abdulawal39's full-sized avatar
🎯
Focusing

Abdul Awal Uzzal abdulawal39

🎯
Focusing
View GitHub Profile
@abdulawal39
abdulawal39 / extract-data-from-multi-select.php
Last active October 1, 2020 17:21
Extract Values from Multi Select DropDown with PHP
<?php
/**
* File Name: extract-data-from-multi-select.php
* Description: A Simple way to Extract Data from a Multi Select Input and Store in a variable with spearating each values with comma.
* Author: Abdul Awal Uzzal
* Author Url: abdulawal.com
* Article: http://themencode.com/?p=435
*/
if(isset($_POST['select_name'])){ // select_name will be replaced with your input filed name
@abdulawal39
abdulawal39 / hide-folder-list-from-public-without-password.php
Last active October 22, 2015 19:31
hide list of folders from public but let authorised people see with a special url
<?php
/**
* Hide List of folders from public with php
* Article url: http://abdulawal.com/hide-list-of-folders-from-public-with-php/
*/
$access = $_REQUEST['access'];
if($access == "admin"){
$dirs = array_filter(glob('*'), 'is_dir');
echo "<ul>";
@abdulawal39
abdulawal39 / register-missing-post-types-wp.php
Last active February 20, 2017 04:41
This code will check database for all the post types and create the ones that are not registered using register_post_type() function
/*
* Register Missing Post Types
* Description: This code will check database for all the post types and create the ones that are not registered using register_post_type() function.
* Author: Abdul Awal Uzzal
* Author URI: https://abdulawal.com/
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
function tnc_register_unavailable_post_types(){
global $wpdb;
@abdulawal39
abdulawal39 / display-additional-fields-data-on-bookings-page-wc-booking.php
Last active February 23, 2023 03:53
Display additional fields data on booking details page woocommerce bookings
<?php
/**
* Display additional fields data on booking details page, fields added using
* Checkout Field Editor (Checkout Manager) for WooCommerce plugin
* @author Abdul Awal Uzzal
* @url abdulawal.com
*/
function tnc_display_additional_checkout_info($booking_id){
@abdulawal39
abdulawal39 / timezones-list.php
Created March 9, 2020 11:45
Timezones Array
$timezone_list = array(
'America/New_York' => 'Eastern Standard Time',
'America/Adak' => 'Hawaii-Aleutian Standard Time',
'America/Atka' => 'Hawaii-Aleutian Standard Time',
'America/Anchorage' => 'Alaska Standard Time',
'America/Juneau' => 'Alaska Standard Time',
'America/Nome' => 'Alaska Standard Time',
'America/Yakutat' => 'Alaska Standard Time',
'America/Dawson' => 'Pacific Standard Time',
'America/Ensenada' => 'Pacific Standard Time',
@abdulawal39
abdulawal39 / timezones-with-gmt-compare.php
Created March 9, 2020 14:05
contains comparison with GMT
array(
'America/New_York' => '(GMT-5:00) America/New_York (Eastern Standard Time)',
'America/Adak' => '(GMT-10:00) America/Adak (Hawaii-Aleutian Standard Time)',
'America/Atka' => '(GMT-10:00) America/Atka (Hawaii-Aleutian Standard Time)',
'America/Anchorage' => '(GMT-9:00) America/Anchorage (Alaska Standard Time)',
'America/Juneau' => '(GMT-9:00) America/Juneau (Alaska Standard Time)',
'America/Nome' => '(GMT-9:00) America/Nome (Alaska Standard Time)',
'America/Yakutat' => '(GMT-9:00) America/Yakutat (Alaska Standard Time)',
'America/Dawson' => '(GMT-8:00) America/Dawson (Pacific Standard Time)',
'America/Ensenada' => '(GMT-8:00) America/Ensenada (Pacific Standard Time)',
@abdulawal39
abdulawal39 / change-basic-fonts-pdf-viewer-for-wordpress.css
Created April 24, 2020 12:05
To Change fonts of toolbar of PDF Viewer for WordPress Plugin
#toolbarContainer{
font-family: 'Nanum Gothic', sans-serif; // replace with your preferred font family
}
#sidebarContainer{
font-family: 'Nanum Gothic', sans-serif; // replace with your preferred font family
}
#secondaryToolbar{
font-family: 'Nanum Gothic', sans-serif; // replace with your preferred font family
}
input, button, select, label{
@abdulawal39
abdulawal39 / woocommerce-sort-attribute-values-in-dropdown.php
Last active May 4, 2020 23:53
Sort WooCommerce Product Attribute Values on single product page. Details on: https://abdulawal.com/?p=1463
/**
* Sort Attribute values in ascending order for any attribute
* @param array $args
* @return array return sorted $args array
*/
function abd_sort_wc_attribute_values( $args ){
$get_options = $args['options'];
asort( $get_options );
$args['options'] = $get_options;
return $args;
@abdulawal39
abdulawal39 / woocommerce-sort-attribute-values-for-specific-attribute.php
Last active May 5, 2020 00:10
Sort WooCommerce Product Attribute Values on single product page only for specific attributes. Details on: https://abdulawal.com/?p=1463
/**
* Sort Attribute values in ascending order for specific attributes
* @param array $args
* @return array return sorted $args array
*/
function abd_sort_wc_attribute_values( $args ){
if( $args['attribute'] == "Attribute Name" ){ // replace Attribute Name with your attribute's name
$get_options = $args['options'];
asort( $get_options );
$args['options'] = $get_options;
@abdulawal39
abdulawal39 / nofollow-pdf-viewer-for-wordpress.php
Created June 5, 2020 07:51
Code to make PDF Viewer for WordPress viewer pages nofollow for search engines.
function tnc_nofollow_pdf_viewer(){
echo '<meta name="robots" content="noindex">';
}
add_action('tnc_pvfw_head', 'tnc_nofollow_pdf_viewer');