Skip to content

Instantly share code, notes, and snippets.

View sagarjadhav's full-sized avatar

Sagar Jadhav sagarjadhav

  • rtCamp Inc
  • Pune
View GitHub Profile
@sagarjadhav
sagarjadhav / remove-wp-comments.php
Created July 10, 2013 08:52
Remove commment support from post, pages, admin menu and admin bar.
<?php
/* Remove Comments Tab from admin menu */
function rtp_remove_admin_menus() {
remove_menu_page('edit-comments.php');
}
add_action('admin_menu', 'rtp_remove_admin_menus');
/* Remove commment support from post and pages */
@sagarjadhav
sagarjadhav / drag-tab-slider.css
Last active December 22, 2015 10:48
Drag-able Tab Slider
/* Dragable Slider */
.slider-wrapper { background: #DDD; width: 540px; }
.handle-containment { height: 34px; position: relative; }
.handle { position: relative; display: inline-block; height: 34px; width: 180px; top: -34px; padding-bottom: 1px; background: rgba(0, 0, 0, 0); font-weight: bold; color: #FFF; text-decoration: none; text-align: center; line-height: 34px; text-indent: -9999px; }
.nav-areas { margin: 0; position: relative; }
.nav-areas li { float: left; height: 34px; list-style: none; text-align: center; width: 180px; }
.nav-areas a { color: white; font-size: 0.8125em; line-height: 34px; text-decoration: none; display: block; cursor: pointer; position: relative; z-index: 20; }
@sagarjadhav
sagarjadhav / hide-div-on-outside-click.js
Last active December 22, 2015 19:49
jQuery to hide a DIV when the user clicks outside of it.
$(document).mouseup(function (e) {
var container = $("YOUR CONTAINER SELECTOR");
/* if the target of the click isn't the container */
/* Nor a descendant of the container */
if ( !container.is(e.target) && container.has(e.target).length === 0) {
container.hide();
}
});
@sagarjadhav
sagarjadhav / smooth-scroll.js
Created September 13, 2013 06:14
jQuery smooth scroll animation
/* Smooth Scroll */
jQuery('.rtp-back-to-top').click( function() {
jQuery('html, body').animate({
scrollTop: jQuery( jQuery(this).attr('href') ).offset().top
}, 1000);
return false;
});
@sagarjadhav
sagarjadhav / equal-height.js
Created September 24, 2013 12:01
jQuery Equal Height Elements
/* Equal Height */
jQuery('.elemWrapper').each(function(){
var max = Math.max.apply(Math, jQuery(this).find('.elem').map(function() { return jQuery(this).height(); }));
jQuery(this).addClass('fixed-height').find('.elem').height(max);
});
/* select element styling */
jQuery('.rtp-select').each( function() {
var self = jQuery(this),
title = self.attr('title');
if( jQuery('option:selected', this).val() !== '' ) title = jQuery('option:selected', this).text();
self
.css({
'z-index': 10,
'opacity': 0,
@sagarjadhav
sagarjadhav / count.php
Last active August 29, 2015 13:57
Carousel: open and close the slide wrapper depends on count
<?php
$count = 0;
$count_2 = 0;
$total_count = count( $post );
if( $count == 0 ) {
echo '<div>';
}
@sagarjadhav
sagarjadhav / list-to-select.js
Last active August 29, 2015 14:03
List convert to Select
/* List convert to Select */
$('ul').each(function() {
var list = $(this),
select = $(document.createElement('select')).insertBefore($(this));
select.attr('id','list-id');
$('li', this).each(function() {
var ahref = $(this).children('a'),
target = ahref.attr('target'),
option = $(document.createElement('option'))
.appendTo(select)
@sagarjadhav
sagarjadhav / bbpress-avatar.php
Created July 15, 2014 08:19
Remove small Gravtars from bbPress Forums
<?php
/* Remove small Gravtars from bbPress Forums */
function rtp_remove_bbp_gravatar_null() {
return null;
}
function rtp_remove_bbp_gravatar($author_link, $args) {
return preg_replace('/<a.*<img.*>&nbsp;/iU', '', $author_link);
}
@sagarjadhav
sagarjadhav / wpnav-menu.php
Created July 28, 2014 12:52
Parent class for WP Menu item
<?php
/* Parent class for menu item */
function rtp_add_menu_parent_class( $items ) {
$parents = array();
foreach ( $items as $item ) {
if ( $item->menu_item_parent && $item->menu_item_parent > 0 ) {
$parents[] = $item->menu_item_parent;
}