Skip to content

Instantly share code, notes, and snippets.

View manishsongirkar's full-sized avatar

Manish Songirkar manishsongirkar

  • rtCamp
  • Pune, India
  • 16:26 (UTC +05:30)
View GitHub Profile
@manishsongirkar
manishsongirkar / custom-post-status.php
Last active November 1, 2017 21:34
WordPress custom Post Status
<?php
/**
* Add custom post status
*/
/**
* Register Custom Status
* Add custom post status to Product custom post type
*/
@manishsongirkar
manishsongirkar / Gruntfile.js
Created August 24, 2015 07:09
Grunt Settings
'use strict';
module.exports = function(grunt) {
// load all grunt tasks matching the `grunt-*` pattern
// Ref. https://npmjs.org/package/load-grunt-tasks
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// Fontello Icons
// Note: This is one time running task, so run grunt after update assets/fontello/config.json file
// Ref. https://npmjs.org/package/grunt-fontello
fontello: {
@manishsongirkar
manishsongirkar / equal-height.js
Last active April 6, 2018 10:01
Responsive Equal Height Element
/**
* Responsive Equal Height Element
*
* @param {type} container
* @returns {undefined}
*/
equalheight = function ( container ) {
var currentTallest = 0,
currentRowStart = 0,
@manishsongirkar
manishsongirkar / sticky-navigation
Created December 5, 2014 12:07
jQuery Sticky Navigation for my reference
/**
* Sticky Navigation
*
* @returns {undefined}
*/
$( function () {
// grab the initial top offset of the navigation
var sticky_navigation_offset_top = $( '#rtp-primary-menu' ).offset().top - 4;
@manishsongirkar
manishsongirkar / useragent.js
Last active August 29, 2015 14:07
Check UserAgent and apply class to body tag
jQuery( document ).ready( function() {
var isMobile = {
Android: function() {
return navigator.userAgent.match( /Android/i );
},
BlackBerry: function() {
return navigator.userAgent.match( /BlackBerry/i );
},
iOS: function() {
return navigator.userAgent.match( /iPhone|iPad|iPod/i );
@manishsongirkar
manishsongirkar / Character-Length
Created September 10, 2014 11:42
Show short text and append Read More link, instead of full text by using jQuery. After click on Read More, show full text.
jQuery( document ).ready( function() {
/**
* Show Short Content
* Add Read More link after short text,
* Show full content after click on Read More
*
* Usage:
* jQuery( '.my-selector' ).rtpCharLength();
*/
( function( $ ) {
@manishsongirkar
manishsongirkar / category-desc-wp_editor
Created August 29, 2014 07:49
Add wp_editor to Category Description and remove default category description box
/**
* Remove HTML Filtering
*/
remove_filter( 'pre_term_description', 'wp_filter_kses' );
remove_filter( 'term_description', 'wp_kses_data' );
/**
* Add WP_Editor to Category Description
*
* @param type $tag
@manishsongirkar
manishsongirkar / add category to pages
Created October 18, 2012 11:01
Add Wordpress Category list in pages as shown in posts
function create_page_taxonomy() {
register_taxonomy( 'category', array( 'page', 'post' ), array(
'hierarchical' => true,
'label' => __( 'Categories' ),
'singular_label' => __( 'Category' ),
'show_ui' => true,
'query_var' => true,
'rewrite' => true
) );
}
@manishsongirkar
manishsongirkar / add field in media upload
Created October 18, 2012 10:55
Add Custom input field in media uploader.
/**
* Add Photographer Name and URL fields to media uploader
*
* @param $form_fields array, fields to include in attachment form
* @param $post object, attachment record in database
*
* @return $form_fields, modified form fields
*/
function rtp_attachment_field_credit( $form_fields, $post ) {
$form_fields['rtp-photographer-name'] = array(
@manishsongirkar
manishsongirkar / Equal Height using jQuery
Created September 18, 2012 08:40
Make Equal Height using jQuery
/* Function Declaration for Equal Height */
function rtp_equalHeight( group ) {
var tallest = 0;
group.each( function() {
var thisHeight = jQuery( this ).height();
if ( thisHeight > tallest ) {
tallest = thisHeight;
}
} );
group.height( tallest );