Skip to content

Instantly share code, notes, and snippets.

@imath

imath/functions.php

Created Jul 30, 2014
Embed
What would you like to do?
MesoColumn Theme & BuddyDrive : fixing user nav css issue
<?php
/**
* Override BuddyDrive default css by filtering buddydrive_global_css
*
* The array to return needs to be like :
*
* array(
* 'stylesheet_uri' => url to the new css file
* 'deps' => array of registered css dependencies
* )
*
* BuddyDrive uses dashicons, so by default $css_data['deps'] = array( 'dashicons' );
* In this filter i don't edit it. But if theme author is using a custom icon font and registers
* it using wp_register_style(), then it can also override it from this filter.
*
* For this example to work, you need to :
* 1- copy this code and paste it at the end of theme's functions.php file
* 2- create a new subdirectory to /wp-content/plugins/themes/mesocolumn/lib called buddydrive
* 3- then copy paste the /wp-content/plugins/buddydrive/includes/css/buddydrive.css file into the folder created at 2
* 4- you should have : /wp-content/plugins/themes/mesocolumn/lib/buddydrive/buddydrive.css
* 5- Remove line 234 of this file to have :
* nav#buddydrive-item-nav ul {
* list-style: none;
* margin:0;
* }
* The problem came from the overflow:hidden css rule.
*
*
* @param array $css_data the stylesheet and eventual dependencies
* @return array $css_data
*/
function mesocolumn_override_buddydrive_css( $css_data = array() ) {
// Return original if not found
if ( ! file_exists( trailingslashit( get_stylesheet_directory() ) . 'lib/buddydrive/buddydrive.css' ) ) {
return $css_data;
}
// Override BuddyDrive Default css
$css_data['stylesheet_uri'] = trailingslashit( get_template_directory_uri() ) .'lib/buddydrive/buddydrive.css';
// Finally return this new stylesheet
return $css_data;
}
add_filter( 'buddydrive_global_css', 'mesocolumn_override_buddydrive_css', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment