In WordPress theme and development, Hooks are functions that can be applied to an Action or a Filter in WordPress. Actions and Filter Hooks allow you to add your own functionality or modify your theme’s behavior by hooking a callback function onto a specific tag in the core code, setting priorities, and using parameters and arguments passed to the callback function.
To insert Actions or Filter Hooks you need to have installed the Child Theme and insert the code snippets in the functions.php file:
- Filter subtitles in header
- Manage post types in Post Index module
- Filter nonce on Adatpive Images
- Manage pages in the Uncode backend lateral menu
- Enable debug mode
- Manage Premium Plugin list
- Disabling Gutenberg custom editor styles
- Filter image url to resize
- Filter image url after resizing
- Enable No Cookies YouTube videos
- Manage the list of roles between select author profiles
- Filter the WordPress core custom background feature
- Filter the editor content width
- Block videos on mobile
- Allow parallax effect on mobile
- Hide the Call To Action menu
- Filter the Call To Action menu
- Hide the Menu Cart
- Hide the Menu Cart on desktop devices
- Hide the Menu Cart on mobile devices
- Filter a particular consent for GDPR privacy
- Filter Content Block content
- Add content before title in Default (Basic) Header
- Add content after title in Default (Basic) header
- Add content before title in default header
- Add content after title in default header
- Filter URLs of background videos
- Filter URLs of self-hosted audios
- Replace the URL of a self-hosted audio with your preferred one
- Filter media titles
- Filter media excerpts
- Display icons on categories
- Display icons on tags
- Filter content in Page builder loops
- Enable I Recommend This
- Out of stock badge
- Enable WooCommerce default breadcrumbs
- Change the WooCommerce archive default subtitle
- Change the WooCommerce archive default subtitle in page
- Enable the search form on nav bar
- Enable the social icons on nav bar
- Socials Module list of icons
- Filter the content of the Custom Heading module
- Filter the gallery media item IDs
- Filter to append dynamic CSS in the head
- Filter to apply an alternate checkbox look on backend
- Filter the home url of the breadcrumbs
- Disable nonce verification when saving the Privacy Preferences
- Action to append something at the top of the body tag
- Action to append something at the bottom
- Disable related products
- Don't fill related posts with random products
- Disable media filtering in Media Gallery for performance
- Disable Frontend Editor shortkeys
- Disable Frontend Editor shortkeys when TinyMCE has focus
- Frontend Editor shortkeys map
- Restore native automatic title on widgets
- Filter WooCommerce cart icon on the desktop menu
- Filter WooCommerce cart icon on mobile menu
- Enable native WordPress Lazy Loading
- Don't remove WooCommerce legacy VC blocks
- Filter the list of taxonomies available in the Posts Module (Taxonomy Query)
- Enable native WP lazy loading
- Disable custom integration for YITH Wishlist
- Disable Side-Cart
- Disable Side-Cart on mobile
- Filter the list of pages to exclude in catalog mode
- Use tags instead of categories to get related posts
- Use tags instead of categories to get related products
- Change the order of related products (default random)
- Don't show the Quick View button for a specific product only
- Change table title on Cart page
- Hide the Menu Login/Account icon
- Hide the Menu Login/Account icon on desktop devices
- Hide the Menu Login/Account on mobile devices
- Hide the Menu Wishlist icon
- Hide the Menu Wishlist icon on desktop devices
- Hide the Menu Wishlist on mobile devices
- Don't enable icon notification for core plugins
- Don't enable icon notification for core plugins
- Set your own API key to add YouTube videos to the Media Library
- Don't track recently viewed products by default
- Add a rel attribute to social links
- Add Open/Close label to Burger icon
- Allow parallax animation on mobile
- Set the Background Scroll Color Changer animation time value
- Disable Related Posts from being filled with random posts
- Don't trigger WC fragments on page load
- Display comment time
- Change the breakpoint used by Dynamic Srcset
- Update and install Uncode Core from a remote server
- Exclude out of stock products from Uncode related products
- Filter the Heading Tag of Widgets
- Add parameters to Vimeo videos in Lightbox
- Change default CPT Taxonomy name in Info Box module
- Filter shortcode params of Posts Module
- Display term description in swatches and AJAX filters
- Display term description in swatches and AJAX filters (product attributes only)
- Change widget title tag
- Use WooCommerce query while filtering a product attribute
- Fix Menu Center Nav Items Order with Przelewy24 Payment Gateway Plugin
- Preventing zoom on mobile
- Show lightbox close button on mobile (LightGallery)
- Scrollable max height for MegaMenu
- Disable Row Parallax Below a Certain Screen Width
- Disable hover on scroll when Smoothscroll is active
/********************** * * Filter subtitles in header * @param string $subtitle Automatic subtitle * @return string * **********************/ add_filter( 'uncode_archive_subtitle', 'uncode_child_filter_archive_subtitle' ); function uncode_child_filter_archive_subtitle( $subtitle ){ if ( is_category( 'your_category_slug' ) ) { $subtitle = 'Your alternative subtitle'; } return $subtitle; }
/********************** * * Manage post types in Post Index module * @param array $post_types `post` post type * @return array * **********************/ add_filter( 'uncode_default_post_type_archive', 'uncode_child_filter_default_post_type_archive' ); function uncode_child_filter_default_post_type_archive( $post_types ){ $custom_post_types = array( 'books', 'movies' ); $post_types = array_merge( $post_types, $custom_post_types ); return $post_types; }
/********************** * * Filter nonce on Adatpive Images * @return bool * **********************/ add_filter( 'uncode_enable_nonce_adaptive_images', '__return_true' );
/********************** * * Manage pages in the Uncode backend lateral menu * @param array $pages The list of pages * @return array * **********************/ add_filter( 'uncode_get_admin_panel_menu_pages', 'uncode_child_filter_get_admin_panel_menu_pages' ); function uncode_child_filter_get_admin_panel_menu_pages( $pages ){ $pages['support'] = array( 'title' => esc_html__( 'Custom page', 'uncode-child' ), 'page_title' => esc_html__( 'Custom page', 'uncode-child' ), 'description' => esc_html__( 'Custom description', 'uncode-child' ), 'url' => admin_url( 'admin.php?page=uncode-child-custom' ) ); return $pages; }
/********************** * * Enable debug mode * @return bool * **********************/ add_filter( 'uncode_enable_debug_on_js_scripts', '__return_true' );
/********************** * * Manage Premium Plugin list * @param array $plugins The list of plugins * @return array * **********************/ add_filter( 'uncode_get_premium_plugins', 'uncode_child_filter_uncode_get_premium_plugins' ); function uncode_child_filter_uncode_get_premium_plugins( $plugins ){ $plugins['custom-plugin'] = array( 'plugin_name' => 'Custom plugin', 'plugin_slug' => 'custom-plugin', 'plugin_path' => 'custom-plugin/custom-plugin.php', 'plugin_url' => trailingslashit( WP_PLUGIN_URL ) . 'custom-plugin', 'remote_url' => 'https://remote_url.com/api.json', 'zip_url' => 'https://zip_url.com/custom-plugin.zip', 'required' => false, 'version' => '1.0.0', 'force_activation' => false, 'force_deactivation' => false, ); return $plugins; }
/********************** * * Disabling Gutenberg custom editor styles * @return bool * **********************/ add_filter( 'uncode_disable_custom_gutenberg_editor_styles', '__return_true' );
/********************** * * Filter image url to resize * @param string $url Image url to resize * @return string * **********************/ add_filter( 'uncode_url_for_resize', 'uncode_child_filter_url_for_resize' ); function uncode_child_filter_url_for_resize( $url ){ //ex. $url = 'http://old.url.com/name-of-image.jpg' $url = str_replace( 'old', 'new', $url ); return $url; }
/********************** * * Filter image url after resizing * @param string $url Resized image url * @return string * **********************/ add_filter( 'uncode_resized_image_url', 'uncode_child_filter_resized_image_url' ); function uncode_child_filter_resized_image_url( $url ){ //ex. $url = 'http://old.url.com/name-of-image.jpg' $url = str_replace( 'old', 'new', $url ); return $url; }
/********************** * * Enable No Cookies YouTube videos * @return bool * **********************/ add_filter( 'uncode_nocookie', '__return_true' );
/********************** * * Manage the list of roles between select author profiles * @param array $role_list List of author between select to display Author Info Box. Def: array('administrator','editor','author') * @return array * **********************/ add_filter( 'uncode_author_profile_role', 'uncode_child_filter_author_profile_role' ); function uncode_child_filter_author_profile_role( $role_list ){ $add_role = array( 'manager' ); $role_list = array_merge( $role_list, $add_role ); return $role_list; }
/********************** * * Filter the WordPress core custom background feature * @param array $default( 'default-color' => 'ffffff', 'default-image' => '') * @return array * **********************/ add_filter( 'uncode_custom_background_args', 'uncode_child_filter_custom_background_args' ); function uncode_child_filter_custom_background_args( $default ){ $default['default-color'] = 'ff0000'; return $default; }
/********************** * * Filter the editor content width * @param number $width Default 840 * @return $width * **********************/ add_filter( 'uncode_content_width', 'uncode_child_content_width' ); function uncode_child_content_width( $width ){ $width = 1024; return $width; }
/********************** * * Block videos on mobile * @return bool * **********************/ add_filter( 'uncode_block_mobile_videos', '__return_true' );
/**********************
*
* Allow parallax effect on mobile
* @return bool
*
**********************/
add_filter( 'uncode_mobile_parallax_animation_allowed', '__return_true' );
/********************** * * Hide the Call To Action menu * @param string $on_off Default value taken from Theme Options: `on` or `off` * @return $on_off * **********************/ add_filter( 'uncode_cta_menu_hide', 'uncode_child_filter_cta_menu_hide' ); function uncode_child_filter_cta_menu_hide( $on_off ){ $on_off = 'off'; return $on_off; }
/********************** * * Filter the Call To Action menu * @param string $menu Default Call To Action menu * @return $menu * **********************/ add_filter( 'uncode_cta_menu', 'uncode_child_filter_cta_menu' ); function uncode_child_filter_cta_menu( $menu ){ if ( get_the_id() == 26 ) { $menu = 'my-alternative-menu'; } return $menu; }
/********************** * * Hide the Menu Cart * @param string $on_off Default value taken from Theme Options: `on` or `off` * @return $on_off * **********************/ add_filter( 'uncode_woo_cart', 'uncode_child_filter_woo_cart' ); function uncode_child_filter_woo_cart( $on_off ){ $on_off = 'off'; return $on_off; }
/********************** * * Hide the Menu Cart on desktop devices * @param string $on_off Default value taken from Theme Options: `on` or `off` * @return $on_off * **********************/ add_filter( 'uncode_woo_cart_desktop', 'uncode_child_woo_cart_desktop' ); function uncode_child_woo_cart_desktop( $on_off ){ $on_off = 'off'; return $on_off; }
/********************** * * Hide the Menu Cart on mobile devices * @param string $on_off Default value taken from Theme Options: `on` or `off` * @return $on_off * **********************/ add_filter( 'uncode_woo_cart_mobile', 'uncode_child_woo_cart_mobile' ); function uncode_child_woo_cart_mobile( $on_off ){ $on_off = 'off'; return $on_off; }
/********************** * * Filter a particular consent for GDPR privacy * @param bool $bool Default value taken from Privacy Plugin user settings * @param string $consent_id The ID to filter (ex. `youtube` or `vimeo`) * @return $bool * **********************/ add_filter( 'uncode_privacy_has_consent', 'uncode_child_privacy_has_consent', 10, 2 ); function uncode_child_privacy_has_consent( $bool, $consent_id ){ if ( $consent_id == 'youtube' ) { $bool = true; } return $bool; }
/********************** * * Filter Content Block content * @param string $content The content of the footer * @return $content * **********************/ add_filter( 'uncode_filter_for_translation', 'uncode_child_filter_for_translation' ); function uncode_child_filter_for_translation( $content ){ if ( get_the_id() == 24 ){ $content = 'My alternative content'; } return $content; }
/********************** * * Add content before title in basic header * @param string $content Empty by default * @return $content * **********************/ add_filter( 'uncode_before_header_title', 'uncode_child_filter_before_header_title' ); function uncode_child_filter_before_header_title( $content ){ if ( get_post_type() === 'post' ){ $content = 'Content before title'; } return $content; }
/********************** * * Add content after title in basic header * @param string $content Empty by default * @return $content * **********************/ add_filter( 'uncode_after_header_title', 'uncode_child_filter_after_header_title' ); function uncode_child_filter_after_header_title( $content ){ if ( get_post_type() === 'post' ){ $content = 'Content after title'; } return $content; }
/********************** * * Add content before title in default header * @param string $content Empty by default * @return $content * **********************/ add_filter( 'uncode_before_body_title', 'uncode_child_filter_before_body_title' ); function uncode_child_filter_before_body_title( $content ){ if ( get_post_type() === 'post' ){ $content = 'Content before title'; } return $content; }
/********************** * * Add content after title in default header * @param string $content Empty by default * @return $content * **********************/ add_filter( 'uncode_after_body_title', 'uncode_child_filter_after_body_title' ); function uncode_child_filter_after_body_title( $content ){ if ( get_the_id() == 24 ){ $content = 'Content after title'; } return $content; }
/********************** * * Filter URLs of self-hosted videos * @param string $url Original video url * @return $url * **********************/ add_filter( 'uncode_self_video_src', 'uncode_child_filter_self_video_src' ); function uncode_child_filter_self_video_src( $url ) { $cdn_url = 'https://your.cdnurl.net/'; $site_url = site_url( '', 'https' ); $url = str_replace( $site_url, $cdn_url, $url ); return $url; }
/********************** * * Filter media titles * @param string $title The original title * @param id $thumb_id The thumb ID * @return $title * **********************/ add_filter( 'uncode_media_attribute_title', 'uncode_child_filter_media_attribute_title', 10, 2 ); function uncode_child_filter_media_attribute_title( $title, $thumb_id ){ if ( $thumb_id == 246 ){ $title = 'Your new media title'; } return $title; }
/********************** * * Filter media excerpts * @param string $excerpt The original excerpt * @param id $thumb_id The thumb ID * @return $excerpt * **********************/ add_filter( 'uncode_media_attribute_excerpt', 'uncode_child_filter_media_attribute_excerpt', 10, 2 ); function uncode_child_filter_media_attribute_excerpt( $excerpt, $thumb_id ){ if ( $thumb_id == 246 ){ $excerpt = 'Your new media excerpt'; } return $excerpt; }
/********************** * * Display icons on categories * @return bool * **********************/ add_filter( 'uncode_display_category_icon', '__return_false' );
/********************** * * Display icons on tags * @return bool * **********************/ add_filter( 'uncode_display_tag_icon', '__return_false' );
/********************** * * Filter content in Page builder loops * @param string $content The original content * @param id $post_id The post ID * @return $content * **********************/ add_filter( 'uncode_block_data_content', 'uncode_child_filter_block_data_content', 10, 2 ); function uncode_child_filter_block_data_content( $content, $post_id ) { if ( $post_id == 26 ){ $content = 'Your new content'; } return $content; }
/********************** * * Enable I Recommend This * @return bool * **********************/ add_filter( 'uncode_dot_irecommendthis', '__return_true' );
/********************** * * Out of stock badge * @param string $content 'Out of stock' badge markup * @param object $post_obj Post object * @param WC_Product $product Product object * @return $content * **********************/
add_filter( 'uncode_woocommerce_out_of_stock', 'uncode_child_filter_woocommerce_out_of_stock', 10, 3 ); function uncode_child_filter_woocommerce_out_of_stock( $content, $post_obj, $product ) { $content = '<div class="font-ui"><div class="woocommerce"><span class="soldout">Your new content</span></div></div>'; return $content; }
/********************** * * Enable WooCommerce default breadcrumbs * @return bool * **********************/ add_filter( 'uncode_woocommerce_breadcrumbs', '__return_true' );
/********************** * * Enable the search form on nav bar * @param string $on_off Default value taken from Theme Options: `on` or `off` * @return $on_off * **********************/ add_filter( 'uncode_search_active', 'uncode_child_filter_search_active' ); function uncode_child_filter_search_active( $on_off ){ $on_off = 'off'; return $on_off; }
/********************** * * Change the WooCommerce archive default subtitle on 'product' post type registration * @param array $var Array with all the settings of the 'product' post type * @return $var * **********************/ add_filter( 'woocommerce_register_post_type_product', 'uncode_child_filter_wc_register_post_type_product' ); function uncode_child_filter_wc_register_post_type_product( $var ) { $var['description'] = false; //to display nothing or the string you prefer (ex: 'Whatever you prefer';) return $var; };
/********************** * * Change the WooCommerce archive default subtitle when displayed on the page * @param string $subtitle The default archive subtitle (in case of product archives: 'This is where you can add new products to your store') * @return $subtitle * **********************/ add_filter( 'uncode_archive_subtitle', 'uncode_child_filter_archive_subtitle', 10, 1 ); function uncode_child_archive_subtitle( $subtitle ) { if ( ( function_exists('is_shop') && is_shop() ) || ( function_exists('is_product_category') && is_product_category() ) || ( function_exists('is_product_tag') && is_product_tag() ) ) { $subtitle = false;//to display nothing or the string you prefer (ex: 'Whatever you prefer';) } return $subtitle; };
/********************** * * Enable the social icons on nav bar * @param string $on_off Default value taken from Theme Options: `on` or `off` * @return $on_off * **********************/ add_filter( 'uncode_socials_active', 'uncode_child_filter_socials_active' ); function uncode_child_filter_socials_active( $on_off ){ $on_off = 'off'; return $on_off; }
/********************** * * Socials module list of icons * @param array $icon_list List of social icons with titles, icons and links * @return $on_off * **********************/ add_filter( 'uncode_vc_socials', 'uncode_child_filter_vc_socials' ); function uncode_child_filter_vc_socials( $icon_list ){ $new_social = array( array( 'title' => 'Facebook', '_uncode_social' => 'fa fa-github', '_uncode_link' => 'https://github.com/your_slug/' ) ); $icon_list = array_merge( $icon_list, $new_social ); return $icon_list; }
/********************** * * Filter the content of the Custom Heading module * @param string $content Ex: * @param array $icon_list Ex: * @param array $icon_list Ex: * @return $content * **********************/ add_filter( 'uncode_vc_custom_heading_content', 'uncode_child_filter_vc_custom_heading_content', 10, 3 ); function uncode_child_filter_vc_custom_heading_content( $content, $auto_text, $is_header ){ $on_off = 'off'; return $content; }
/********************** * * Filter the gallery media item IDs * @param id $item_thumb_id The thumb ID * @return $item_thumb_id * **********************/ add_filter( 'uncode_vc_gallery_thumb_id', 'uncode_child_filter_vc_gallery_thumb_id' ); function uncode_child_filter_vc_custom_heading_content( $item_thumb_id ){ if ( $item_thumb_id == 246 ) { $item_thumb_id = 302; } return $item_thumb_id; }
/********************** * * Filter to append dynamic CSS in the head * **********************/ add_filter( 'uncode_append_custom_styles_to_head', 'uncode_child_append_custom_styles_to_head' ); function uncode_child_append_custom_styles_to_head() { return true; }
/********************** * * Alternate checkbox look on backend * @param string $classes The body classes on the backend * @return $classes * **********************/ add_action('admin_body_class', 'uncode_child_admin_body_classes'); function uncode_child_admin_body_classes( $classes ){ $classes .= 'ckbx-alt'; return $classes; }
/********************** * * Filter the Home url of the breadcrumbs * @param string $url Home url * @return $url * **********************/ add_filter( 'uncode_breadcrumbs_home_url', 'uncode_child_filter_breadcrumbs_home_url' ); function uncode_child_filter_breadcrumbs_home_url( $url ){ if ( is_single() ) { $page_for_posts = get_option( 'page_for_posts' ); $url = get_permalink( $page_for_posts ); } return esc_url( $url ); }
/********************** * * Disable nonce verification when saving the privacy preferences * @return bool * **********************/ add_filter( 'uncode_privacy_enable_nonce_privacy_preferences', '__return_false' );
/********************** * * Action to append something at the top of the body tag * **********************/ add_action( 'before', 'uncode_child_hook_before' ); function uncode_child_hook_before(){ echo 'something'; }
/********************** * * Action to append something at the bottom of the function uncode_create_single_block() that prints elements inside loops * **********************/ add_action( 'uncode_create_single_block', 'uncode_child_hook_create_single_block' ); function uncode_child_hook_create_single_block(){ echo 'something'; }
/********************** * * Disable related products * @return bool * **********************/ add_filter( 'uncode_show_woocommerce_related_products', '__return_false' );
/********************** * * Don't fill related posts with random posts when nothing found * @return bool * **********************/ add_filter( 'uncode_disable_random_posts_on_related', '__return_true' );
/********************** * * Disable media filtering in Media Gallery for performance reasons * @return bool * **********************/ add_filter( 'uncode_disable_media_filtering', '__return_true' );
/********************** * * Disable Frontend Editor shortkeys * @return bool * **********************/ add_filter( 'uncode_enable_front_editor_shortkeys', '__return_false' );
/********************** * * Disable Frontend Editor shortkeys when TinyMCE has focus * @return bool * **********************/ add_filter( 'uncode_enable_front_editor_shortkeys_in_tinymce', '__return_false' );
/********************** * * Frontend Editor shortkeys map * @param string $keys Default shortkeys * @return array * **********************/ add_filter( 'uncode_front_editor_shortkeys', 'uncode_child_front_editor_shortkeys' ); function uncode_child_front_editor_shortkeys( $default_keys ) { // Get keycode here: https://keycode.info/ $keys = array( 'save' => 83, // s 'close' => 87, // w 'left' => 65, // a 'right' => 68, // d 'modifier' => 'alt' // alt, ctrl, shift ); return $keys; }
/********************** * * Restore native automatic title on widgets * **********************/ add_action( 'init', 'remove_uncode_remove_empty_widget_titles' ); function remove_uncode_remove_empty_widget_titles(){ remove_filter( 'widget_title', 'uncode_remove_empty_widget_titles', 10 ); }
/********************** * * Filter WC cart icon on desktop menu * @param string $woo_icon Add whatever you want by following the markup used inside the menu * @return string * **********************/ add_filter( 'uncode_woo_cart_icon', 'uncode_child_woo_cart_icon' ); function uncode_child_woo_cart_icon( $woo_icon ){ if ( get_option('woocommerce_myaccount_page_id') ) { $woo_icon = '' . $woo_icon; } return $woo_icon; }
/********************** * * Filter WC cart icon on mobile menu * @param string $woo_icon_mobile Add whatever you want by following the markup used inside the menu * @return string * **********************/ add_filter( 'uncode_woo_cart_icon_mobile', 'uncode_child_woo_cart_icon_mobile' ); function uncode_child_woo_cart_icon_mobile( $woo_icon_mobile ){ if ( get_option('woocommerce_myaccount_page_id') ) { $woo_icon_mobile = '' . $woo_icon_mobile; } return $woo_icon_mobile; }
/********************** * * Enable native WordPress 5.5 Lazy Loading * @return bool * **********************/ add_filter( 'uncode_lazy_loading_enabled', '__return_true');
/********************** * * Don't remove WooCommerce legacy VC blocks * @return bool * **********************/ add_filter( 'uncode_remove_legacy_wc_blocks', '__return_false' );
/********************** * * Filter the list of taxonomies available in the Posts Module (Taxonomy Query) * @param array $taxonomies List of public taxonomies * @return array * **********************/ add_filter( 'uncode_get_registered_taxonomies', 'uncode_child_get_registered_taxonomies' ); function uncode_child_get_registered_taxonomies( $taxonomies ) { unset( $taxonomies['tax-to-remove'] ); return $taxonomies; }
/********************** * * Enable native WP lazy loading * @return bool * **********************/ add_filter( 'uncode_lazy_loading_enabled', '__return_true' );
/********************** * * Disable custom integration for YITH Wishlist * @return bool * **********************/ add_filter( 'uncode_use_custom_yith_wishlist', '__return_false' );
/********************** * * Disable Side-Cart * @return bool * **********************/ add_filter( 'uncode_woocommerce_sidecart_enabled', '__return_false' );
/********************** * * Disable Side-Cart on mobile * @return bool * **********************/ add_filter( 'uncode_woocommerce_sidecart_mobile_enabled', '__return_false' );
/********************** * * Filter the list of pages to exclude in catalog mode * @param array $pages List of pages to exclude * @return array * **********************/ add_filter( 'uncode_catalog_mode_pages_to_exclude', 'uncode_child_catalog_mode_pages_to_exclude' ); function uncode_child_catalog_mode_pages_to_exclude( $pages ) { $new_page_id_to_exclude = 12; $pages[] = $new_page_id_to_exclud; return $pages; }
/********************** * * Use tags instead of categories to get related posts * @return bool * **********************/ add_filter( 'uncode_use_cat_in_posts_for_related_posts', '__return_false' );
/********************** * * Use tags instead of categories to get related products * @return bool * **********************/ add_filter( 'uncode_use_cat_in_products_for_related_posts', '__return_false' );
/********************** * * Change order of related products (default random) * @param string $order Default order * @return string * **********************/ add_filter( 'uncode_related_posts_query_products_order', 'uncode_child_related_posts_query_products_order' ); function uncode_child_related_posts_query_products_order( $order ) { $order = 'title'; // rand, date, id, menu_order, rating, title return $order; }
/********************** * * Don't show Quick View button for a specific product only * @param bool $show Show or not. * @param int $product_id Product ID. * @return bool * **********************/ add_filter( 'uncode_show_quick_view_button', 'uncode_child_show_quick_view_button', 10, 2 ); function uncode_child_show_quick_view_button( $show, $product_id ) { if ( $product_id === 1234 ) { return false; } return $show; }
/********************** * * Change table title in Cart page * @param string $title Default title. * @return string * **********************/ add_filter( 'uncode_woocommerce_cart_table_title', 'uncode_child_woocommerce_cart_table_title' ); function uncode_child_woocommerce_cart_table_title( $title ) { $title = 'Your new title'; return $title; }
/********************** * * Hide the Menu Login/Account icon * @param string $on_off Default value taken from Theme Options: `on` or `off` * @return $on_off * **********************/ add_filter( 'uncode_login_account', 'uncode_child_filter_login_account' ); function uncode_child_filter_login_account( $on_off ){ $on_off = 'off'; return $on_off; }
/********************** * * Hide the Menu Login/Account icon on desktop devices * @param string $on_off Default value taken from Theme Options: `on` or `off` * @return $on_off * **********************/ add_filter( 'uncode_login_account_desktop', 'uncode_child_login_account_desktop' ); function uncode_child_woo_cart_desktop( $on_off ){ $on_off = 'off'; return $on_off; }
/********************** * * Hide the Menu Login/Account on mobile devices * @param string $on_off Default value taken from Theme Options: `on` or `off` * @return $on_off * **********************/ add_filter( 'uncode_login_account_mobile', 'uncode_child_login_account_mobile' ); function uncode_child_woo_cart_mobile( $on_off ){ $on_off = 'off'; return $on_off; }
/********************** * * Hide the Menu Wishlist icon * @param string $on_off Default value taken from Theme Options: `on` or `off` * @return $on_off * **********************/ add_filter( 'uncode_woo_wishlist', 'uncode_child_filter_woo_wishlist' ); function uncode_child_filter_woo_wishlist( $on_off ){ $on_off = 'off'; return $on_off; }
/********************** * * Hide the Menu Wishlist icon on desktop devices * @param string $on_off Default value taken from Theme Options: `on` or `off` * @return $on_off * **********************/ add_filter( 'uncode_woo_wishlist_desktop', 'uncode_child_woo_wishlist_desktop' ); function uncode_child_woo_wishlist_desktop( $on_off ){ $on_off = 'off'; return $on_off; }
/********************** * * Hide the Menu Wishlist on mobile devices * @param string $on_off Default value taken from Theme Options: `on` or `off` * @return $on_off * **********************/ add_filter( 'uncode_woo_wishlist_mobile', 'uncode_child_woo_wishlist_mobile' ); function uncode_child_woo_wishlist_mobile( $on_off ){ $on_off = 'off'; return $on_off; }
/********************** * * Don't enable icon notification for core plugins * @return bool * **********************/ add_filter( 'uncode_enable_core_updates_icon_notification', '__return_false' );
/********************** * * Set your own API key to add YouTube videos to the Media Library * @param string $api_key Your personal Google YouTube API key * @return string * **********************/ add_filter( 'uncode_google_api_key', 'uncode_child_filter_google_api_key' ); function uncode_child_filter_google_api_key( $api_key ){ $api_key = 'your_google_youtube_api_key'; return $api_key; }
/********************** * * Don't track recently viewed products by default * @return bool * **********************/ add_filter( 'uncode_woocommerce_disable_product_view_tracking', '__return_true' );
/********************** * * Add a rel attribute to social links * @param string $rel Value of the rel attribute * @return string * **********************/ add_filter( 'uncode_social_link_rel', 'uncode_child_social_link_rel' ); function uncode_child_social_link_rel( $rel ){ $rel = 'noopener noreferrer'; return $rel; }
/********************** * * Add Open/Close label to burger icon * @return string * **********************/ add_filter( 'uncode_burger_open_label', 'uncode_child_burger_open_label' ); function uncode_child_burger_open_label ( $open ) { return 'Open'; } add_filter( 'uncode_burger_close_label', 'uncode_child_burger_close_label' ); function uncode_child_burger_close_label ( $close ) { return 'Close'; }
/********************** * * Allow parallax animation on mobile * @return bool * **********************/ add_filter( 'uncode_mobile_parallax_animation_allowed', '__return_true' );
/********************** * * Set the Background Scroll Color Changer animation time value * @return int Milliseconds * **********************/ add_filter( 'uncode_bg_changer_time', 'uncode_child_bg_changer_time' ); function uncode_child_bg_changer_time () { return 1000; }
/********************** * * Don't fill related posts with random posts when nothing found * @return bool * **********************/ add_filter( 'uncode_disable_random_posts_on_related', '__return_true' );
/********************** * * Don't trigger WC fragments on page load * @return bool * **********************/ add_filter( 'uncode_update_wc_fragments_on_load', '__return_false' );
/********************** * * Display comment time * @return bool * **********************/ add_filter( 'uncode_display_comment_time', '__return_true' );
/********************** * * Change the breakpoint used by Dynamic Srcset * to replace background images in mobile devices * @param int $breakpoint the original breakpoint value (570) * @return int * **********************/ function uncode_child_dynamic_srcset_bg_mobile_breakpoint( $breakpoint ) { $breakpoint = 678; return $breakpoint; } add_filter( 'uncode_dynamic_srcset_bg_mobile_breakpoint', 'uncode_child_dynamic_srcset_bg_mobile_breakpoint' );
/********************** * * Upgrade and install Uncode Core from remote. * @return bool * **********************/ add_filter( 'uncode_enable_remote_uncode_core', '__return_true' );
/**********************
*
* Exclude out of stock products from Uncode related products query (not Related Posts for WordPress Plugin)
* @param array $args Default related posts query
* @return $args
*
**********************/
function uncode_related_posts_query_exclude_outofstock( $args ) {
$args['meta_query'] = array(
array(
'key' => '_stock_status',
'value' => 'instock'
)
);
return $args;
}
add_filter( 'uncode_related_posts_query', 'uncode_related_posts_query_exclude_outofstock' );
/********************** * * Filter the Heading Tag of Widgets * @param string $title_tag Default value `h3` * @return $title_tag * **********************/ add_filter( 'uncode_widget_title_tag', 'uncode_child_widget_title_tag' ); function uncode_child_widget_title_tag( $title_tag ){ $title_tag = 'h6'; return $title_tag; }
/********************** * * Add parameters to Vimeo videos in Lightbox * @param string $param Default '?autoplay=0' * @return string * **********************/ add_filter( 'uncode_vimeo_params', 'uncode_child_vimeo_params' ); function uncode_child_vimeo_params( $param ) { $param = '?muted=0'; return $param; }
/********************** * * Change default Custom Post Type Taxonomy name in Info Box module * @param string $tax Default CPT taxonomy name * @return string * **********************/ add_filter( 'uncode_cpt_taxonomy_for_info_box' , 'uncode_child_cpt_taxonomy_for_info_box' ); function uncode_child_cpt_taxonomy_for_info_box( $tax ){ $ctp_slug = 'your_cpt_slug'; if ( $tax === "{$ctp_slug}_category" ) { $tax = 'custom_tax'; } return $tax; }
/********************** * * Filter shortcode paramas of Posts Module * @param array $atts Array of attributes * @return array * **********************/ add_filter( 'uncode_index_shortcode_atts', 'uncode_child_filter_uncode_index_shortcode_atts' ); function uncode_child_filter_uncode_index_shortcode_atts( $atts ) { // Change Posts Module class on page with ID 123 if ( is_page( 123 ) ) { $atts['el_class'] = 'new-class'; } return $atts; }
/********************** * * Display term description in swatches and AJAX filters * @return bool * **********************/ add_filter( 'uncode_show_term_description', '__return_true' );
/********************** * * Display term description in swatches and AJAX filters (product attributes only) * @return bool * **********************/ function uncode_child_show_term_description( $show, $term ) { if ( isset( $term->taxonomy ) && ( strpos( $term->taxonomy, 'pa_' ) === 0 ) ) { return true; } return $show; } add_filter( 'uncode_show_term_description', 'uncode_child_show_term_description', 10, 2 );
/********************** * * Change widget title tag * @param array $tag Default title tag * @return $tag * **********************/ add_filter( 'uncode_widge_title_tag', 'uncode_child_widge_title_tag' ); function uncode_child_widge_title_tag( $tag ) { $tag = 'h6'; return $tag; }
/********************** * * Use WooCommerce query while filtering a product attribute * @return bool * **********************/ add_filter( 'uncode_use_woocommerce_nav_attributes_query', '__return_true' );
/********************** * * Fix Menu Center Nav Items Order with Przelewy24 Payment Gateway Plugin * @return $priority * **********************/ function uncode_center_nav_menu_items_priority( $priority ){ $priority = 9; return $priority; } add_filter( 'uncode_center_nav_menu_items_priority', 'uncode_center_nav_menu_items_priority' )
/********************** * * Filter meta viewport preventing zoom on input fields (mobile) * @param meta $meta The original meta * @return $meta * **********************/ add_filter( 'uncode_meta_viewport', 'uncode_child_filter_meta_viewport' ); function uncode_child_filter_meta_viewport( $meta ) { $meta .= ',maximum-scale=1,user-scalable=0'; return $meta; }
/********************** * * Show lightbox close button on mobile (LightGallery) * @return bool * **********************/ add_filter( 'uncode_lightgallery_enable_close_button_mobile', '__return_true' );
/********************** * * Scrollable mega menu * @return bool * **********************/ add_filter( 'uncode_scrollable_megamenu', '__return_true');
/********************** * * Disable Row Parallax Below a Certain Screen Width * @param number $val Default 960 * @return $val * **********************/ add_filter( 'uncode_smooth_scroll_query', 'uncode_child_smooth_scroll_query' ); function uncode_child_smooth_scroll_query( $val ) { $val = 0; return $val; }
/********************** * * Disable hover on scroll when Smoothscroll is active * @return bool * **********************/ add_filter( 'uncode_smooth_scroll_disable_hover', '__return_true' );
Comments
0 comments
Article is closed for comments.