Skip to content

Instantly share code, notes, and snippets.

View sagarjadhav's full-sized avatar

Sagar Jadhav sagarjadhav

  • rtCamp Inc
  • Pune
View GitHub Profile
<?php
// Xprofile get fileds by group
if ( bp_has_profile( array( 'user_id' => $user_id ) ) ) {
while ( bp_profile_groups() ) : bp_the_profile_group();
$group_name = bp_get_the_profile_group_name();
if ( ( 'Social' == $group_name) && bp_profile_group_has_fields() ) {
echo '<div id="bb-profile-group-fields">';
while ( bp_profile_fields() ) : bp_the_profile_field();
@sagarjadhav
sagarjadhav / the_content_by_id.php
Created November 13, 2016 08:57
Get content by page ID
<?php
/*
* Get content by page ID
*/
function marvy_the_content_by_id( $id ) {
if ( isset( $id ) && 0 != $id ) {
global $post;
$post = get_post( $id );
setup_postdata( $post );
select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: url('./images/angle-arrow-down.svg') 98% / 15% no-repeat;
background-size: 9px;
border: 0;
border-bottom: 1px solid #e1e1e1;
border-radius: 0;
<?php
// Define custom post type string
define( 'CUSTOM_POST_TYPE', 'affiliates' );
/**
* Register the meta box
*/
if ( !function_exists( 'page_templates_dropdown_metabox' ) ) {
@sagarjadhav
sagarjadhav / remove-setting-nav-buddypress.php
Created December 1, 2015 12:05
Remove "Nav" items from profile navigation
<?php
/**
* Remove "Nav" items from profile navigation
*/
function bp_remove_settings_nav() {
global $bp;
unset( $bp->bp_nav[ 'settings' ] );
unset( $bp->bp_nav[ 'messages' ] );
unset( $bp->bp_nav[ 'notifications' ] );
@sagarjadhav
sagarjadhav / remove-subnav-item-buddypress.php
Last active December 1, 2015 12:03
Remove subnav item BuddyPress
<?php
function bp_remove_nav_item() {
global $bp;
bp_core_remove_subnav_item( $bp->profile->slug, 'change-avatar' );
}
add_action( 'wp', 'bp_remove_nav_item' );
@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;
}
@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 / 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 / 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>';
}