1. Home
  2. Kleo
  3. Developer

Chapter: Developer

Snippets, actions, filters, examples of changing theme using code

Changing section icons in profiles and groups

On profile and group pages, you’ll see icon bars like the one shown above. You can change these icons to anything you want, here’s how… 1: CSS IDs Start by finding the CSS selector for the icon you want to change. You will need the id of the <li > element associated with the icon. On profile pages it will end with “-personal-li” and […]

Show profile fields in the members directory

Code Source: https://pastebin.com/raw/zpg7gwNr This snippet should be added to wp-content/themes/kleo-child/functions.php Note : You will have to adapt this function for your needs by changing the name of the fields Location and Specialization from the example shown. Field names are case sensitive and must match exactly. Examples: $location = bp_get_member_profile_data(‘field=Location’); $specialization = bp_get_member_profile_data(‘field=Specialization’); field=Location represents name of the field that we […]

Show profile fields in the profile header

Code Source: http://pastebin.com/raw/QByiEAhH This snippet should be added to wp-content/themes/kleo-child/functions.php Note : You will have to adapt this function for your needs by changing the name of the fields Location and Specialization from the example shown. Field names are case sensitive and must match exactly. Examples : $location = bp_get_member_profile_data(‘field=Location’); $specialization = bp_get_member_profile_data(‘field=Specialization’); field=Location represents name of the field that […]

Error 404 – Page not found

An Error 404 is generated when the browser is unable to find a page, image, video etc. It’s not unusual to see an Error 404 in WordPress and the most common cause is updating a custom post type or taxonomy, this can occur when updating a plugin. Resolving Error 404 Go to WP Admin > Settings > Permalinks and re-save […]

How to change logo url

To change the URL of the logo on click, follow these steps: Add this function in child theme functions.php Example 1 /* Set logo a href link to home */ function sq7_custom_logo_href() { //$kleo_logo_href = ‘google.com/’; $kleo_logo_href = home_url(‘/home/’); return $kleo_logo_href; } add_filter(‘kleo_logo_href’, ‘sq7_custom_logo_href’); Replace home_url(‘/home/’); with new route like : home_url(‘/category/post-1’); or for external website use commented line example […]

Troubleshooting an issue

Overview You may encounter various issues when building your site. This is especially true as you add more functionality from plugins and custom code. You can follow the below steps to isolate the issue you’re facing and potentially remedy the situation. For each of the steps below you will need to pure your browsers cache. This can be achieved in […]

UberMenu Integration

KLEO works pretty much out of the box with UberMenu. There are just a few settings tweaks that need to be made: UberMenu Settings Menu Bar Alignment If you want the menu to be aligned to the right of your logo, set the menu bar alignment to “Right” Skin To mimic the original theme menu most closely, choose the Vanilla […]

Reset Kleo Love/Likes

By using the next SQL query you will be able to reset whole posts to 0 love/likes SELECT * FROM ‘wp_postmeta’ WHERE ‘meta_key’ = ‘_item_likes’ AND meta_value != 0; That’s all

Show Kleo Love/Likes Only for logged in Users

If you need to show KLEO likes/love only to logged in users you can do that by using this function function AllowKleoLikesToLoggedInUsers () { global $kleo_item_likes; if(!is_user_logged_in()) { remove_action(‘publish_post’, array($kleo_item_likes, ‘setup_likes’)); remove_action(‘kleo_post_footer’, array($kleo_item_likes, ‘show_likes’)); remove_action(‘kleo_show_love’, array($kleo_item_likes, ‘show_likes’)); remove_action(‘wp_ajax_item-likes’, array($kleo_item_likes, ‘ajax_callback’)); remove_action(‘wp_ajax_nopriv_item-likes’, array($kleo_item_likes, ‘ajax_callback’)); } } add_action(‘after_setup_theme’, ‘AllowKleoLikesToLoggedInUsers’, 99); The function will be added to wp-content/themes/kleo-child/functions.php

Add a custom color preset for Theme options Styling sections

Starting with KLEO 4.0 you can now define your own custom styling presets to apply to sections from Theme options – Styling. To add a custom color preset just add this code to your kleo-child/functions.php file and modify the values to match your needs: add_filter(‘section_color_presets’, ‘kleo_my_add_custom_color_preset’); function kleo_my_add_custom_color_preset( $presets ) { $presets[‘my-preset-slug’] = array( ‘alt’ => ‘My color preset name’, […]

Modify default image sizes from category pages

By default KLEO generates the images at the size of 460×270 for your archive pages like your main blog page or category page. To change the image dimensions you just need to have you child theme active and add this small snippet to kleo-child/functions.php   add_action( ‘after_setup_theme’, ‘kleo_custom_media_size’, 20 ); function kleo_custom_media_size() { global $kleo_config; $kleo_config[‘post_gallery_img_width’] = 260; //initial was […]