Skip to content

Instantly share code, notes, and snippets.

@Alipio123
Created September 28, 2019 07:30
Show Gist options
  • Save Alipio123/a196e1b369ee5dac61aeaba4ae4e1faf to your computer and use it in GitHub Desktop.
Save Alipio123/a196e1b369ee5dac61aeaba4ae4e1faf to your computer and use it in GitHub Desktop.
Elementor heading line height will inherit the theme astra customizer. Paste the code under functions.php
<?php
/**
* Custom Style that is base from the theme/
* Cons: Doesnt show real time edit in the customizer
*/
add_action('wp_head', 'custom_style_base_theme' );
function custom_style_base_theme() {
ob_start();
$output = "";
//you can replace the `astra_get_option` with your Theme GET Customizer Option. Wordpress example: get_theme_mod('header_color', '#000000');
//API Link https://codex.wordpress.org/Theme_Customization_API
//Astra Customize get option
$h1_lineheight = astra_get_option('line-height-h1');
$h2_lineheight = astra_get_option('line-height-h2');
$h3_lineheight = astra_get_option('line-height-h3');
$h4_lineheight = astra_get_option('line-height-h4');
$h5_lineheight = astra_get_option('line-height-h5');
$h6_lineheight = astra_get_option('line-height-h6');
?>
<style type="text/css">
.elementor-widget-heading h1.elementor-heading-title {
line-height: <?php echo $h1_lineheight; ?>;
}
.elementor-widget-heading h2.elementor-heading-title {
line-height: <?php echo $h2_lineheight; ?>;
}
.elementor-widget-heading h3.elementor-heading-title {
line-height: <?php echo $h3_lineheight; ?>;
}
.elementor-widget-heading h4.elementor-heading-title {
line-height: <?php echo $h4_lineheight; ?>;
}
.elementor-widget-heading h5.elementor-heading-title {
line-height: <?php echo $h5_lineheight; ?>;
}
.elementor-widget-heading h6.elementor-heading-title {
line-height: <?php echo $h6_lineheight; ?>;
}
</style>
<?php
$output = ob_get_clean();
//It will print the code in <head>
echo $output;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment