Child theme – various code snippets

These are various code snippets that should be added in child theme’s functions.php file (/kallyas-child/functions.php) to override or customize certain functionality.

To customize the heading tags throughout the theme, please access Customize Heading Tags (SEO purposes).

Remove Facebook’s Open Graph code:#

You may want to add a custom Open graph plugin with more advanced features so it’s recommended to remove the Facebook Open Graphs code included in the theme eg: http://hogash.d.pr/9WYW

add_action( 'zn_after_body', 'zmn_remove_og', 0 );
function zmn_remove_og() {
 remove_action( 'zn_after_body', 'zn_add_open_graph', 10 );
}

 

Add Custom code (CSS, JS, HTML) in <body> tag:#

It often happens you need to add a custom code (any code) in the Body tag (at the begining). To do that, simply add this code and replace [ code here ] with your own code.

function wp2356_add_custom_body_code() {
 ?>

 [ code here ]

 <?php
}
add_action( 'zn_after_body', 'wp2356_add_custom_body_code', 50 );

You can place code in the header with wp_head (between <head> tags) or wp_footer (at the end of <body> tag) instead of zn_after_body action.

 

Override main menu’s pointer for menu items having sub-menus#

By default, the main menu pointer is actually a very discrete dash. You can change to arrow pointer or even remove it. Try  following codes that you can add to the child theme’s functions.php .

function wp886759_change_mainmenu_pointer(){
  return 'mainnav--pointer-arr';
}
add_filter('kallyas_mainmenu_pointer_style','wp886759_change_mainmenu_pointer');

To remove the pointer use this:

function wp886759_mainmenu_pointer_none(){
  return 'mainnav--pointer-none';
}
add_filter('kallyas_mainmenu_pointer_style','wp886759_mainmenu_pointer_none');