Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Escape all translations with
*/
__( ‘Some String’, ‘text-domain’ ); _e( ‘Some string’, ‘text-domain’ );.
/**
* When there is no HTML use:
*/
var arr = [4,2,5,3];
function myRd(arr,callback){
var val=arr[0];
for(i=1;i<arr.length;i++){
val = callback(val,arr[i]);
}
return val;

Zip excluding specific directories

Exclude .git file and node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/\*

Exclude .git file and files in node_modules directory, but keep node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/**\*
@stalukder03
stalukder03 / gulpfile.js
Created October 4, 2020 12:29 — forked from braginteractive/gulpfile.js
Gulp 4 and WordPress Development
// Load all the modules from package.json
var gulp = require( 'gulp' ),
plumber = require( 'gulp-plumber' ),
autoprefixer = require('gulp-autoprefixer'),
watch = require( 'gulp-watch' ),
jshint = require( 'gulp-jshint' ),
stylish = require( 'jshint-stylish' ),
uglify = require( 'gulp-uglify' ),
rename = require( 'gulp-rename' ),
notify = require( 'gulp-notify' ),
@stalukder03
stalukder03 / WordPress Conditional Custom Meta Box
Created January 9, 2021 04:04 — forked from WagnerMatos/WordPress Conditional Custom Meta Box
WordPress Custom Meta Box that can used only on certain post types, pages, etc.
<?php
/*/////////////////////////////////////////////////////////////////////////////////////
//// Load scripts and styles for Meta box */
// enqueue scripts and styles, but only if is_admin
if(is_admin()) {
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('jquery-ui-slider');
wp_enqueue_script('custom-js', get_template_directory_uri().'/library/metaboxes/js/custom-js.js');
wp_enqueue_style('jquery-ui-custom', get_template_directory_uri().'/library/metaboxes/css/jquery-ui-custom.css');
@stalukder03
stalukder03 / upload.js
Created June 28, 2022 05:48 — forked from Cheslab/upload.js
WordPress Media Library with pre-selected items
/**
* Utilize WordPress' media library. Easy select/upload files for your plugin/theme admin page.
* It uses build-in jQuery 1.4.1
* Tested with WordPress 5.2.4
*/
$('.my-upload-button').click(function(e) {
e.preventDefault();
// setup our media library frame
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WordPress Coding Standards" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<description>A custom set of rules to check for a WPized WordPress project</description>
<!-- What to scan -->
<file>.</file>
<!-- Exclude the Composer Vendor directory. -->
<!-- <exclude-pattern>/vendor/*</exclude-pattern> -->
/db
/plugins
/uploads
/logs