Skip to content

Instantly share code, notes, and snippets.

View manidip's full-sized avatar

Manidip Mandal manidip

  • AurionPro
  • Delhi
View GitHub Profile
@manidip
manidip / gist:dd04a8e47f74616b6269543156343d32
Created July 27, 2018 05:59 — forked from thiamteck/gist:877276
JQuery Datepicker with Month and Year only
$(document).ready(function(){
$(".monthPicker").datepicker({
dateFormat: 'mm-yy',
changeMonth: true,
changeYear: true,
showButtonPanel: true,
onClose: function(dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
@manidip
manidip / wordpress-tinymce.js
Created July 2, 2018 04:29 — forked from RadGH/wordpress-tinymce.js
Get/Set content of a TinyMCE visual or text editor with JavaScript
/*
Based on: http://wordpress.stackexchange.com/questions/42652/#answer-42729
These functions provide a simple way to interact with TinyMCE (wp_editor) visual editor.
This is the same thing that WordPress does, but a tad more intuitive.
Additionally, this works for any editor - not just the "content" editor.
Usage:
@manidip
manidip / wp-fill-missing-alt-tags.php
Created June 14, 2018 06:03 — forked from RadGH/wp-fill-missing-alt-tags.php
Fill in alt text for images in post content
<?php
/*
If alt text isn't included in image attributes from the_content, it is added in.
And, if alt text is not given, image caption or title will be used instead.
BEFORE:
<img src="http://example.org/image.jpg" alt="This alt text is entered by hand!" width="1500" height="996" />
<img src="http://example.org/image.jpg" alt="" width="1500" height="996" />
<img src="http://example.org/image.jpg" alt='' width="1500" height="996" />
<img src="http://example.org/image.jpg" alt width="1500" height="996" />
@manidip
manidip / filter-wc-shipping-methods-and-payment-gateways.php
Created June 14, 2018 06:02 — forked from RadGH/filter-wc-shipping-methods-and-payment-gateways.php
Filter woocommerce shipping methods and payment gateway by user role.
<?php
/*
Plugin Name: Homestead Apothecary - Role Based Shipping and Checkout
Plugin URI: http://alchemyandaim.com/
Description: Customizes the availability of shipping methods and checkout gateways based on user role. No settings are available for this plugin, customizations must be made to the plugin directly.
Author: Alchemy + Aim
Author URI: https://alchemyandaim.com/
*/
define( 'HA_RBSC_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
@manidip
manidip / wp-upload-image-from-url.php
Created June 14, 2018 06:02 — forked from RadGH/rs_upload_from_url.php
Upload an image to WordPress media gallery from URL
<?php
/**
* Retrieves an image from a URL and uploads it using ld_handle_upload_from_path. See that function for more details.
*
* Note: This function should also work for local file paths as well, but the implementation is slightly different than ld_handle_upload_from_path.
*
* @param $image_url
* @param int $attach_to_post
* @param bool|true $add_to_media
@manidip
manidip / short-number-format.php
Created June 13, 2018 12:12 — forked from RadGH/short-number-format.php
Short Number Formatter for PHP (1000 to 1k; 1m; 1b; 1t)
<?php
// Converts a number into a short version, eg: 1000 -> 1k
// Based on: http://stackoverflow.com/a/4371114
function number_format_short( $n, $precision = 1 ) {
if ($n < 900) {
// 0 - 900
$n_format = number_format($n, $precision);
$suffix = '';
} else if ($n < 900000) {
@manidip
manidip / wp-taxonomy-dropdown.php
Created May 10, 2018 06:32 — forked from eduardozulian/wp-taxonomy-dropdown.php
Callback function for 'meta_box_cb' argument inside register_taxonomy() that replaces the regular checkboxes with a plain dropdown list
<?php
/**
* Callback function for taxonomy meta boxes
*
* A simple callback function for 'meta_box_cb' argument
* inside register_taxonomy() that replaces the regular
* checkboxes with a plain dropdown list
*
* @param [type] $post [description]
* @param [type] $box [description]
@manidip
manidip / pe-customize-controls.css
Created April 26, 2018 07:04 — forked from OriginalEXE/pe-customize-controls.css
Extending WordPress Customizer Panels and Sections to allow nesting
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent,
#customize-theme-controls .customize-pane-child.current-section-parent {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
}
@manidip
manidip / List.md
Created December 12, 2017 07:26 — forked from msurguy/List.md
List of open source projects made with Laravel

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):

<?php
/*
* WordPress Breadcrumbs
* author: Dimox
* version: 2017.21.01
* license: MIT
*/
function dimox_breadcrumbs() {
/* === OPTIONS === */