Skip to content

Instantly share code, notes, and snippets.

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

Mohammad Limon mlbd

🏠
Working from home
View GitHub Profile
function wpse64458_in_widget_form($t,$return,$instance){
$instance = wp_parse_args( (array) $instance, array( 'column' => 'default', 'title' => '') );
if ( !isset($instance['column']) )
$instance['column'] = null;
?>
<p>
<label for="<?php echo $t->get_field_id('column'); ?>"><?php esc_html_e('Column', 'textdomain'); ?>: </label>
<select id="<?php echo $t->get_field_id('column'); ?>" name="<?php echo $t->get_field_name('column'); ?>">
<option <?php selected($instance['column'], 'default');?> value="default"><?php esc_html_e('Default', 'textdomain'); ?></option>
<option <?php selected($instance['column'], '1');?>value="1"><?php esc_html_e('1', 'textdomain'); ?></option>
First go the mysql folder where your localhost install. in my case I'm using xampp.
In reqular xampp password will be blank as default unless you set something. If it is blank then you can just leave as blank like
--password=
========================
1. cd C:\xampp\mysql\bin
2. mysqldump --user=root --password=password mydbname > mydbname-backup.sql
========================
Backup file will be avaliable in C:\xampp\mysql\bin folder.
For more info visit.
@mlbd
mlbd / code.php
Created April 11, 2019 10:58 — forked from dtbaker/code.php
Add a custom control to an existing Elementor widget
// This example will add a custom "select" drop down to the "Image Box"
// This will change the class="" on the rendered image box so we can style the Image Box differently
// based on the selected option from the editor.
// The class will be "my-image-box-style-blue" or "my-image-box-style-green" based on the selected option.
add_action('elementor/element/before_section_end', function( $section, $section_id, $args ) {
if( $section->get_name() == 'image-box' && $section_id == 'section_image' ){
// we are at the end of the "section_image" area of the "image-box"
$section->add_control(
@mlbd
mlbd / csv_stream.php
Created March 19, 2019 13:22 — forked from damncabbage/csv_stream.php
CSV via File Handle
<?php
class CSVStream {
/**
* List of available source fields.
*
* @var array
*/
protected $fields = array();
/**
* First of all change prefix if you have different one. As default WordPress has `wp_`
*/
# Update post meta to another meta key
# Transfer one post meta to another meta key
UPDATE wp_postmeta SET meta_key = 'new_key_name' WHERE meta_key = 'old_key_name';
// Update home and siteurl.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
$fullsize_path = get_attached_file( 40 );
echo "<pre>";
$csv_stream = new CSVStream($fullsize_path, array(), array('header_rows' => 1));
for ($index=0; $index < $csv_stream->computeCount(); $index++) {
$csv_stream_data = $csv_stream->getNextRow();
if ( email_exists( $csv_stream_data->email ) ) {
$user = get_user_by( 'email', $csv_stream_data->email );
@mlbd
mlbd / webstoemp-gulpfile.js
Created January 7, 2019 05:53 — forked from jeromecoupe/webstoemp-gulpfile.js
Gulp 4 sample gulpfile.js
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
@mlbd
mlbd / fontawesome5-php-array.php
Created November 21, 2018 11:34 — forked from smartcatdev/fontawesome5-php-array.php
Font Awesome 5 - Icon PHP Array
function fa_icons() {
return array (
'fab fa-500px' => __( '500px', 'buildr' ),
'fab fa-accessible-icon' => __( 'accessible-icon', 'buildr' ),
'fab fa-accusoft' => __( 'accusoft', 'buildr' ),
'fas fa-address-book' => __( 'address-book', 'buildr' ),
'far fa-address-book' => __( 'address-book', 'buildr' ),
'fas fa-address-card' => __( 'address-card', 'buildr' ),
'far fa-address-card' => __( 'address-card', 'buildr' ),
/**
* Create Programmatically WP nav menu from API
*
* 1. First retrieve data from url
* 2. Then Clean nav menu items if already have any
* 3. Add nav menu items dynamically by using wp_update_nav_menu_item()
*
* @package binAmmer
* @author mlimon
*/
@mlbd
mlbd / Create Programmatically WordPress Nav menu
Last active October 22, 2024 09:21
Programmatically create wp nav menu from external json file
/**
* Registers a wp nav menu Programmatically.
*
* @link https://codex.wordpress.org/Function_Reference/wp_get_nav_menu_object
* @link https://codex.wordpress.org/Function_Reference/wp_create_nav_menu
* @link https://developer.wordpress.org/reference/functions/wp_update_nav_menu_item/
* @link https://developer.wordpress.org/reference/functions/wp_remote_get/
* @link https://codex.wordpress.org/Function_API/wp_remote_retrieve_body
*
* @since 1.0