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
@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();
@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' ),
/**
* First of all change prefix if you have different one. As default WordPress has `wp_`
*/
// 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';
// Update posts guid.
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
@mlbd
mlbd / SASS - Both.sublime-build
Created February 22, 2018 09:58 — forked from dropddesigns/SASS - Both.sublime-build
SASS Build script to build both uncompressed and compress CSS files
{
"cmd": [
"sass", "--update", "--watch", "$file:${file_path}/${file_base_name}.css", "--sourcemap=none", "--stop-on-error", "--no-cache", "--style", "expanded",
"&",
"sass", "--update", "$file:${file_path}/${file_base_name}.min.css", "--stop-on-error", "--no-cache", "--style", "compressed"
],
"selector": "source.sass, source.scss",
"line_regex": "Line ([0-9]+):",
@mlbd
mlbd / SublimeOnSaveBuild.sublime-settings
Created February 22, 2018 09:08 — forked from jawinn/SublimeOnSaveBuild.sublime-settings
Regex to ignore SASS / LESS partials (files starting with underscore) from being built by SublimeOnSaveBuild
// UPDATED VERSION
{
"filename_filter": "(/|\\\\|^)(?!_)(\\w+)\\.(css|js|sass|less|scss)$",
"build_on_save": 1
}
// DEFAULT (for reference, in case you need it back)
{
"filename_filter": "\\.(css|js|sass|less|scss)$",
"build_on_save": 1
@mlbd
mlbd / How to detect if a WordPress plugin is active.php
Created November 19, 2017 13:02 — forked from llgruff/How to detect if a WordPress plugin is active.php
A function you can use to check if plugin is active/loaded for your plugins/themes
<?php
/**
* Detect if a WordPress plugin is active
* A function you can use to check if plugin is active/loaded for your plugins/themes
* @link //gist.github.com/llgruff/c5666bfeded5de69b1aa424aa80cc14f
*/
// When coding plugins that rely on another one, like Private Content for bbPress or Visual Attributes for WooCommerce, you need to make if the WordPress Plugin is active to initialize your plugin routines or display a notice saying that the required plugin must be activated. In this tutorial we’ll see how to detect whether a certain plugin is active in a couple of ways.
## 1. Check whether a certain class or function or constant exists
/*****
- This is a template used by 6 posts within a CPT
- Each post contains some text in the content editor and an ACF Gallery.
- Each image is tagged with category(ies) using Enhanced Media Library plugin.
- The categories used on each page are being echoed out to provide a means to filter the images.
- The lightbox being used is http://photoswipe.com
- The filter is done with http://isotope.com
- Included with the Isotope integration is https://github.com/desandro/imagesloaded