Hide smart area before/after footer
Sometimes, there would be pages where you would not want to display the dynamic content before or after the footer, given that the Smart Area location on footer
is set to before or after.
To meet such requirements we have implemented the following 2 filters that you can use in your child theme’s functions.php
file:
hg_hide_smart_area_before_footer -- hide the smart area content that has been set to be displayed before footer
hg_hide_smart_area_after_footer -- hide the smart area content that has been set to be displayed after footer
Let’s say you don’t want to display the dynamic content before footer on the Contact us page that has been assigned in the theme options. For this you will need to get the ID of that page either by editing it or from the All pages page in your admin area. Secondly, you will need to add a code like this into your child theme’s functions.php
file (for the sake of this example, let’s say the ID of the Contact us page would be 12345):
add_filter( 'hg_hide_smart_area_before_footer', 'hg_hide_smart_area_before_footer', 80);
/**
* Hide the smart area content that has been set to be displayed before footer
* @param bool|false The default value retrieved by the filter
* @return bool
*/
function hg_hide_smart_area_before_footer( $value = false ){
//#! 12345 is the post/page/etc ID to match
if( is_singular() && ( get_the_ID() == 12345 ) ) {
$value = true;
}
return $value;
};