fbpx
  1. Home
  2. Kleo
  3. Developer

Chapter: Developer

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

Add theme metaboxes and theme settings metaboxes CPT

If you’d like to enable the ‘Theme Options Panel’ for a custom post type then add the below code your your KLEO child themes functions.php file. // Add Theme Settings to CPT // function my_cpt_sq_metabox_general_settings($post_types) { $post_types[] = ‘yourCPTslug’; return $post_types; } add_filter(‘sq_metabox_general_settings’, ‘my_cpt_sq_metabox_general_settings’); Note: replace yourCPTslug with the slug for your custom post type. More information For more information […]

Right Hand DropDown Menu Cut Off

#menu-primary-menu.nav.navbar-nav li:hover ul{ left:auto; right:0; margin-right:-10px; } Add this snippet to style.css of child theme to fix the Right Hand DropDown Menu Cut Off Thanks you, zzkamikazezz for the snippet

Show featured image full width before the content area

The code will be added to wp-content/themes/kleo-child/functions.php add_action( ‘kleo_before_main’, ‘sq7rdu_show_featured_before_content’ ); function sq7rdu_show_featured_before_content() { if ( is_single() && has_post_thumbnail() ) { echo ”; the_post_thumbnail( ‘full’ ); echo ”; } } Below is a screenshot with an example of the function usage.

Use custom fontello font icons for in Kleo Theme

You can import additional font icons like this: 1. Go to http://fontello.com 2. Click on this icon from middle page then press import   3. Go to main zip file that you have downloaded from Themeforest in this path : /MainFiles/Assets/Fontello 4. Import/upload config.json 5. Icons from KLEO will appear and you can select additional icons 6. When you are done […]

Add Extra Membership Levels Fields

To add extra fields to membership levels, follow this example: We add a new MESSAGES RESTRICTION and SHOP. The following codes goes to kleo-child/functions.php This manipulates the text that shows in the memberships page: /* These restrictions will appear to be configured in Theme options – Memberships */ add_filter(‘kleo_pmpro_level_restrictions’, ‘kleo_my_levels_checkmarks’); function kleo_my_levels_checkmarks($settings) { $settings = array ( //NEW RESTRICTION MESSAGES […]

Change KLEO Page Title for Archives and Other WordPress Pages

For KLEO we have created a function that generates the titles for all WordPress specific pages. You just need to redefine this function in your child theme/functions.php and rename the strings. Make sure to have the child theme activated. //Add me to child theme functions.php function kleo_title() { $output = “”; if ( is_category() ) { $output = __(‘Archive for […]

How to add a Populated Country List XPROFILE

Hello everyone, this topic is for those who want to have an already populated country list to user xprofile fields instead of adding one by one. Just edit the child theme file “functions.php” and paste the following code: /* If you are using BP 2.1+, this will insert a Country selectbox. Add the function to bp-custom.php and then visit …/wp-admin/users.php?page=bp-profile-setup […]

Custom Post Type – Add Theme Metaboxes and Theme settings Metaboxes

If you have created a custom post type and you want to have the KLEO theme options panel for each custom post type // Add Theme Settings to CPT // // Replace yourCPTslug with your CPT slug // function my_cpt_sq_metabox_general_settings($post_types) { $post_types[] = ‘yourCPTslug’; return $post_types; } add_filter(‘sq_metabox_general_settings’, ‘my_cpt_sq_metabox_general_settings’); Add this function to wp-content/thems/kleo-child/function.php

Remove KLEO from WordPress TinyMCE

If you need to remove the KLEO button from WordPress TinyMCE you will have to add this function add_action( ‘admin_init’, ‘sq_remove_admin_shortcodes_btn’, 12 ); function sq_remove_admin_shortcodes_btn() { global $k_elements_tiny; remove_filter( ‘mce_external_plugins’, array( $k_elements_tiny, ‘add_rich_plugins’ ) ); remove_filter( ‘mce_buttons’, array( $k_elements_tiny, ‘register_rich_buttons’ ) ); } The above code function needs to be pasted in wp-content/themes/kleo-child/functions.php If you have a k-elements lower than […]

Ajax Interval Refresh – Menu Notifications & Messages

Kleo theme has a feature that checks messages and notifications only when BuddyPress plugin is activated. If your website has significant traffic it may be needed to increase the AJAX interval refresh from Wp-admin -> Theme options -> Buddypress -> Live notifications interval and add a higher value like 60000 (60 seconds). Also there it’s a programmatically way to do that […]