Skip to content

Instantly share code, notes, and snippets.

View manishsongirkar's full-sized avatar

Manish Songirkar manishsongirkar

  • rtCamp
  • Pune, India
  • 04:49 (UTC +05:30)
View GitHub Profile
@manishsongirkar
manishsongirkar / vertical_menu_css.css
Created April 5, 2012 08:42
Vertical Dropdown Menu in Wordpress
/* Navigation */
#rt-nav-menu { font-family: 'Droid Sans',sans-serif;height: 100%;list-style: none outside none;margin: 0;padding-top: 0;position: relative;width: 100%; }
#rt-nav-menu li { border-right: 1px solid #BDC59E;float: left;height: 34px;line-height: 150%;list-style: none outside none;padding: 1px 0 0; }
#rt-nav-menu li a { background: url("img/current-menu-notch.jpg") no-repeat scroll right top transparent;color: #333333;display: block;font-size: 14px;font-variant: normal;font-weight: 700;padding: 0 25px 15px 9px;text-decoration: none;text-transform: uppercase; }
#rt-nav-menu li a:hover { background-position: right -95px;border-bottom: 3px solid #74A740;color: #68aa10;padding-bottom: 16px;text-decoration: none; }
#rt-nav-menu li:hover > a { background-position: right -95px;border-bottom: 3px solid #74A740;color: #68aa10;padding-bottom: 16px;text-decoration: none; }
/* Sub Menu Support */
#rt-nav-menu ul { background: none repeat scroll 0 0 #F5FBDE;d
@manishsongirkar
manishsongirkar / metabox_for_custom_template.php
Created April 5, 2012 08:55
Add Metabox for Custom Templates
/* Add Below code where you are adding Metabox */
global $post;
$template_file = get_post_meta( $post->ID, '_wp_page_template', TRUE );
if ( $template_file == 'template-full-width.php' ) {
add_meta_box ( 'post_custom_field_id', __( 'Custom Field', 'rtPanel' ), 'rtp_posts_inner_custom_box', 'page', 'normal', 'high' );
}
@manishsongirkar
manishsongirkar / select_style_css.css
Created April 5, 2012 09:18
Custom Select Drop-down Style
/* Parent Style */
.search-select-parent {
float: left;
margin: 5px 0 0 8px;
position: relative;
}
/* Select Style */
.search-select-parent select {
display: block;
@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 );
@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 / 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 / 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 / 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 / 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 / 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;