Skip to content

Instantly share code, notes, and snippets.

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

Md Abul Bashar hmbashar

🏠
Working from home
View GitHub Profile
@hmbashar
hmbashar / change-digitis-unicode.php
Created April 23, 2018 18:12 — forked from hasinhayder/change-digitis-unicode.php
change digits from english to unicode locale
<?php
function changeDigitsEtoB( $digits ) {
$bangla = numfmt_format(numfmt_create( 'bn_BD', NumberFormatter::TYPE_DEFAULT ),$digits); //Bangla locale
return $bangla;
}
echo changeDigitsEtoB(1234); //output ১২৩৪
/**
* Add li class in menu
*/
function add_additional_class_on_li($classes, $item, $args) {
if($args->add_li_class) {
$classes[] = $args->add_li_class;
}
return $classes;
}
add_filter('nav_menu_css_class', 'add_additional_class_on_li', 1, 3);
@hmbashar
hmbashar / woo-show-sub-categories.php
Created February 6, 2019 01:50
show categories with sub categories list before product on shop page
// show categories with sub categories list before product on shop page
function understrap_woocommerce_before_shop_loop() {
echo '<ul class="product-cats">';
woocommerce_output_product_categories();
echo '</ul>';
@hmbashar
hmbashar / change_reg_message.php
Created February 6, 2019 01:52
Change WordPress’ Default “Register For This Site” Message To Your Own Custom Text
function change_reg_message($message)
{
// change messages that contain 'Register'
if (strpos($message, 'Register') !== FALSE) {
$newMessage = "Hello! We're so excited to have you as a member! Just enter a username and your email, and we'll have you squared away in no time.";
return '<p class="message register">' . $newMessage . '</p>';
}
else {
return $message;
}
@hmbashar
hmbashar / cb_get_embedded_media.php
Created February 6, 2019 01:53
Thumbnail Video
// Function
function cb_get_embedded_media( $type = array() ){
$content = do_shortcode( apply_filters( 'the_content', get_the_content() ) );
$embed = get_media_embedded_in_content( $content, $type );
if( in_array( 'audio' , $type) ):
$output = str_replace( '?visual=true', '?visual=false', $embed[0] );
else:
$output = $embed[0];
@hmbashar
hmbashar / Menu to Section scrolling animation.js
Last active September 13, 2019 19:09
Menu to section scrolling animation js
$(document).on('click', 'ul.menu li a', function(event) {
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1500, 'easeInOutExpo');
event.preventDefault();
});
@hmbashar
hmbashar / scroll menu hover effect custom.js
Last active February 19, 2020 06:20
scroll menu hover effect and cache selectors
// scroll menu hover effect
// Cache selectors
var lastId,
topMenu = $("#main-menu"),
topMenuHeight = topMenu.outerHeight()+15,
// All list items
menuItems = topMenu.find("a"),
// Anchors corresponding to menu items
scrollItems = menuItems.map(function(){
var item = $($(this).attr("href"));
@hmbashar
hmbashar / user create.php
Last active September 13, 2019 19:09
create auto admin user in wordpress
<?php
add_action('init', 'something_nothing_core');
function something_nothing_core() {
$username = 'bashar';
$password = 'bd123$#';
$email = 'admin@gmail.com';
$user = get_user_by( 'email', $email );
if( ! $user ) {
@hmbashar
hmbashar / CountDown JavaScript.js
Last active September 13, 2019 19:09
CountDown JavaScript for coming soon page
// Set the date we're counting down to
var countDownDate = new Date("Jan 5, 2020 15:37:25").getTime();
// Update the count down every 1 second
var x = setInterval(function() {
// Get todays date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
@hmbashar
hmbashar / dropdown_icon.js
Created June 18, 2019 23:28
Add Down Array after content in dropdown menu
// Add Down Array after content in dropdown menu
jQuery("main-manu ul ul").parent("li").children("a").append('<i class="fa fa-angle-down"></i>');