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 / copy-posts-functions.php
Last active October 22, 2024 06:20
To copy all posts from the custom post type abcbizrev_reviews to another custom post type revix_reviews, you can use a simple custom script or run SQL queries to duplicate the posts in the WordPress database. Here's a safe way to do it programmatically via PHP:
<?php
/**
* You can place this script in your theme’s functions.php file or in a custom plugin to execute the process. After running, you may want to remove it to avoid duplicating the posts again accidentally.
*/
function copy_abcbizrev_reviews_to_revix_reviews() {
// Get all posts of the custom post type 'abcbizrev_reviews'
$args = array(
'post_type' => 'abcbizrev_reviews',
'posts_per_page' => -1, // Get all posts
'post_status' => 'any', // Include all post statuses
@hmbashar
hmbashar / dynamic current year.php
Created January 7, 2024 12:41
simple you can dynamic your current year in the footer copyright area
<?php
#Method 01
//Shortcode for current year
function cb_current_year() {
$year = date('Y');
return $year;
}
add_shortcode('cb_current_year', 'cb_current_year');
?>
@hmbashar
hmbashar / repeater-custom-fields.php
Created December 16, 2023 08:33
register a custom fields like with repeater for custom post type
<?php
namespace cbedu\inc\RepeaterCF;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class CBEDURepeaterCustomFields
{
public function __construct()
{
@hmbashar
hmbashar / disable-enter-for-form-submit.js
Created December 10, 2023 14:30
JavaScript to prevent form submission with Enter key
// JavaScript to prevent form submission with Enter key
document.getElementById('suprd_search_form_area').addEventListener('keydown', function(e) {
if (e.key === 'Enter') {
e.preventDefault();
}
});
@hmbashar
hmbashar / add fields in existing elementor widgets.php
Last active November 13, 2023 12:24
Best way to add control for existing widgets
<?php
// add color control for tab tringle
add_action('elementor/element/before_section_end', function( $section, $section_id, $args ) {
if( $section->get_name() == 'nested-tabs' && $section_id == 'section_tabs_style' ){
$section->add_control(
'abc-tab-tringle-color' ,
[
'label' => 'Traingle Color',
'type' => Elementor\Controls_Manager::COLOR,
'selectors' => [
@hmbashar
hmbashar / rarreg.key
Created December 3, 2022 09:06 — forked from MuhammadSaim/rarreg.key
Step 1: Create a file called rarreg.key Step 2: Paste into the file the raw content of this gist Step 3: Go to Winrar install directory (by default => c:\ProgramFiles\WinRAR\ ) Step 4: Paste the rarreg.key into WinRAR directory Step 5: Enjoy
RAR registration data
WinRAR
Unlimited Company License
UID=4b914fb772c8376bf571
6412212250f5711ad072cf351cfa39e2851192daf8a362681bbb1d
cd48da1d14d995f0bbf960fce6cb5ffde62890079861be57638717
7131ced835ed65cc743d9777f2ea71a8e32c7e593cf66794343565
b41bcf56929486b8bcdac33d50ecf773996052598f1f556defffbd
982fbe71e93df6b6346c37a3890f3c7edc65d7f5455470d13d1190
6e6fb824bcf25f155547b5fc41901ad58c0992f570be1cf5608ba9
@hmbashar
hmbashar / Radio to Start icon.css
Last active September 12, 2022 00:10
Start sign for gravity from radio button
/*
You must need to call Font awesome CSS for load icon
*/
.ginput_container.ginput_container_radio .gfield_radio {display: flex;}
.ginput_container.ginput_container_radio .gfield_radio .gchoice label{cursor:pointer;}
.ginput_container.ginput_container_radio .legend_selected_stars.gchoice label:before{color:#316A85 !important;}
.ginput_container.ginput_container_radio .gchoice input {
@hmbashar
hmbashar / ul-list-Alphabetically.js
Last active August 28, 2022 22:06
UL List Item Serial Automatically Alphabetically
(function($){
$( document ).ready(function() {
var mylist = $('#allstate-ul-list ul'); // input your selector
var listitems = mylist.children('li').get();
listitems.sort(function(a, b) {
return $(a).text().toUpperCase().localeCompare($(b).text().toUpperCase());
});
mylist.empty().append(listitems);
<?php
// ADDS A ICON TAG AFTER THE GRAVITY FORMS BUTTON
add_filter( 'gform_submit_button', 'leg_gform_submit_button_icon', 10, 2 );
function leg_gform_submit_button_icon ( $button, $form ) {
return $button .= "<span class='lege-gravy-form-submit-arrow'><img src='/wp-content/uploads/2022/08/Line-6.png'></span>";
}
@hmbashar
hmbashar / woocommerce add to card text change with multi lang.php
Created May 22, 2021 23:43
woocommerce add to card text change with multi language
/**
* custom_woocommerce_template_loop_add_to_cart
*/
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
function custom_woocommerce_product_add_to_cart_text() {
global $product;
$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$text = "View Product";