Skip to content

Instantly share code, notes, and snippets.

View sakilimran's full-sized avatar
🏠
Working from home

S. M. Sakil Imran sakilimran

🏠
Working from home
View GitHub Profile
@sakilimran
sakilimran / Environment_Laravel_Ubuntu.txt
Last active June 12, 2020 20:23
Environment Create For Laravel Development in Ubuntu
# Tested
# Ubuntu 20.04
# PHP 7.4.3
# install composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
<?php
// change "Add to Cart" text in archive product
add_filter( 'woocommerce_product_add_to_cart_text', 'woo_archive_custom_cart_button_text' ); // 2.1 +
function woo_archive_custom_cart_button_text() {
return __( 'Buy Now', 'woocommerce' );
}
?>
<?php
// API access token from Google API's Console
//define('ACCESS_TOKEN', 'ya29.GlvmBr9UH4KLL_Do6pHGOoZ7ksfURRHAqRh3dPWcMiYjNov4hhse_m147qlSwVZIqty989V73iQrtSD3DVT6AVaNtYFEQbQeq1EuUHhRMBTf1Go6lXTPPMzQX6-Q');
// API access key from Google API's Console
define('API_KEY', 'AIzaSyDB5KH7JaT5zRDq8QyRYOt3xMN4fyBaY_c');
// Firebase project id
define('PROJECT_ID', 'skitto-testbed');
class FCM
<?php
// API access token from Google API's Console
define('ACCESS_TOKEN', 'ya29.GlvmBr9UH4KLL_Do6pHGOoZ7ksfURRHAqRh3dPWcMiYjNov4hhse_m147qlSwVZIqty989V73iQrtSD3DVT6AVaNtYFEQbQeq1EuUHhRMBTf1Go6lXTPPMzQX6-Q');
// API access key from Google API's Console
define('API_KEY', 'AIzaSyDB5KH7JaT5zRDq8QyRYOt3xMN4fyBaY_c');
// Firebase project id
define('PROJECT_ID', 'skitto-testbed');
class FCM
@sakilimran
sakilimran / pagination bootstrap cakephp
Last active June 6, 2018 13:28
pagination bootstrap cakephp
<ul class="pagination">
<li><?php echo $this->Paginator->prev('<i class="fa fa-chevron-left"></i>', array('escape'=>false,'tag' => 'li'), null, array('escape'=>false, 'tag' => 'li','class' => 'disabled','disabledTag' => 'a')); ?></li>
<li><?php echo $this->Paginator->numbers(array('separator' => '','currentTag' => 'a', 'currentClass' => 'active','tag' => 'li','first' => 1)); ?></li>
<li><?php echo $this->Paginator->next('<i class="fa fa-chevron-right"></i>', array('escape'=>false, 'tag' => 'li','currentClass' => 'disabled'), null, array('escape'=>false,'tag' => 'li','class' => 'disabled','disabledTag' => 'a')); ?></li>
</ul>
<?php
/**
* Add new register fields for WooCommerce registration.
*/
function wooc_extra_register_fields() {
?>
<p class="form-row form-row-first">
<label for="reg_first_name"><?php _e( 'First name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="first_name" id="reg_first_name" value="<?php if ( ! empty( $_POST['first_name'] ) ) esc_attr_e( $_POST['first_name'] ); ?>" />
@sakilimran
sakilimran / product_categories_dropdown.php
Created April 9, 2017 09:26
WooCommerce - Create shortcode to display product categories dropdown list
<?php
/**
* WooCommerce Custom Shortcode
* --------------------------
*
* Register a shortcode that creates a product categories dropdown list
*
* Use: [product_categories_dropdown]
*
<?php
// change "Add to Cart" text in single product page
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );
function woo_custom_cart_button_text() {
return __( 'Buy Now', 'woocommerce' );
}
?>
<?php
// Reorder single product page tabs
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {
if($tabs['description']){ $tabs['description']['priority'] = 1; } // Description first
if($tabs['additional_information']){ $tabs['additional_information']['priority'] = 2; } // Additional information second
if($tabs['reviews']){ $tabs['reviews']['priority'] = 3; } // Reviews third
return $tabs;
}
?>
<?php
// Rename single product page tab
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
function woo_rename_tabs( $tabs ) {
$tabs['additional_information']['title'] = __( 'Specifications' ); // Rename the additional information tab
return $tabs;
}
?>