Hello Readers!

So today i want to share with you some useful Snippets to use with your KLEO theme.

Snippets are an easy and cool way of customizing your website and adding extra features to make it stand out!

PHP Snippets for KLEO

  • Change side menu font icon with an image.
function kleo_side_menu_button ( $items, $args )
{
if ($args->theme_location == 'primary')
{
$items .= '<li id="nav-menu-item-side" class="menu-item">' .
'<a href="#" rel="nofollow">' .
'*** add your image markup here ***' .
'</a>' .
'';
}
return $items;
}

How to use it:

Copy the code into your childs function.php file

Upload an image to your media folder in dashboard. Then get the url and use standard img tag markup.http://www.w3schools.com/tags/tag_img.asp

Snippet credit: sharmstr

 

  • Stop Registering of Certain Notifications in Activity
//Block certain activity types from being added
function bp_activity_dont_save( $activity_object ) {
$exclude = array(
        'updated_profile',
        'new_member',
        'new_avatar',
        'friendship_created',
        'joined_group'
    );

How to use it:

Copy the code into your childs function.php file
This doesnt hide them, it STOPS them from being saved to the db.

Snippet credit: sharmstr

  • Hide “Upgrade Account” for Certain Memberships
function kleo_membership_info()
{
    global $membership_levels, $current_user;
    if (!$membership_levels) {
        return;
    }

    $levels_arr = array('2','3','4');
    if (bp_is_my_profile()) {
        if ( isset($current_user->membership_level) && in_array($current_user->membership_level->ID, $levels_arr) ) {
            echo '' . $current_user->membership_level->name . '';
        } else {
            echo '' . __("Upgrade account", 'kleo_framework') . '';
        }
    }
}

How to use:
Add the code to your child theme functions.php
Change the level IDs with yours at:

 $levels_arr = array('2','3','4');

This is all for now, have fun!

http://laura-solanes.com/
Do you like Laura Solanes's articles? Follow on social!

Privacy Preference Center

Functionality

We use third-party analytics services to help understand your usage of our services. In particular, we provide a limited amount of your information (such as sign-up date and some personal information like your email address) to 3rd party service and utilize it to collect data for analytics purposes when you visit our website or use our product.

__cfduid,intercom-id-*, intercom-lou-*, intercom-lou-*, intercom-session-*, intercom-session-*, intercom-visitor-session-*

Performance

These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site.

All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.

_ga, _gat_gtag_UA_106868094_1, _gid
IDE
AID
NID,1P_JAR

Advertising

Necessary

These cookies are necessary for the website to function and cannot be turned off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.

You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.

PHPSESSID, wordpress_logged_in_*, wordpress_sec_*, wp-settings-time-1, gdpr[privacy_bar], gdpr[allowed_cookies], gdpr[consent_types]