Advanced Customisations

Below you’ll find advanced customisations that aren’t included in theme settings. These customisations can either be added to a child theme functions.php file or by using the plugin Code Snippets. If you’d like to add a function using Code Snippets:

  1. Install and active the plugin, Code Snippets.
  2. Go to SnippetsImport.
  3. Import the function provided in the form of a XML or JSON file. A XML or JSON file is provided with each function below. Right click and Save As to download.

Disable Sticky Header On Mobile

Disable the sticky header below `768px` or in the case of Polestar Premium, below the point that the Mobile Menu Collapse field is set to.

if ( ! function_exists( 'polestar_child_body_classes' ) ) :
function polestar_child_body_classes( $classes ) {
	$classes[] = 'mobile-header-ns';
  	return $classes;
}
endif;
add_filter( 'body_class', 'polestar_child_body_classes' );

Code Snippets Import File
Disable Sticky Header on Mobile Snippet

Disable Responsive Layout

Disable the responsive layout on mobile devices.

if ( ! function_exists( 'polestar_child_setup' ) ) :
function polestar_child_setup() {
	remove_action( 'wp_head', 'polestar_viewport_tag' );

	function polestar_child_custom_viewport_tag() { ?>
		<meta name="viewport" content="width=1280" />
	<?php }
	add_action( 'wp_head', 'polestar_child_custom_viewport_tag' );	
}
endif;
add_action( 'after_setup_theme', 'polestar_child_setup' );

Code Snippets Import File
Disable Responsive Layout on Mobile Devices Snippet

Disable Smooth Scroll

Disable Polestar's smooth scroll functionality.

if ( ! function_exists( 'polestar_child_body_classes' ) ) :
function polestar_child_body_classes( $classes ) {
  $classes[] = 'disable-smooth-scroll';
  return $classes;
}
endif;
add_filter( 'body_class', 'polestar_child_body_classes' );

Code Snippets Import File
Disable Smooth Scroll Snippet

Adjust Sticky Header Logo Scaling

The sticky header and logo scaling settings can be found at AppearanceCustomizeTheme SettingsHeader. If you’ve enabled these settings and would like to adjust the logo scaling, the following function can be used. The below function won’t work in Code Snippets and needs to be used in a child theme functions.php file.

if ( ! function_exists( 'polestar_child_logo_scaling' ) ) :
function polestar_child_logo_scaling( $scale ) {
	return 0.755;
}
add_filter( 'polestar_logo_sticky_scale', 'polestar_child_logo_scaling' );
endif;

0.755 is the default scaling. Edit this value to adjust the logo scaling.

Change Page Settings Defaults

Using the below function you can adjust the page settings defaults. For example, if you’d like to set new posts and pages to default to Layout: No Sidebar, you could use the following function:

if ( ! function_exists( 'polestar_child_alter_page_setting_defaults' ) ) :
function polestar_child_alter_page_setting_defaults( $defaults, $type, $id ) {
	$defaults['layout'] = 'no-sidebar';

	return $defaults;
}
endif;
add_filter( 'puro_page_settings_defaults', 'polestar_child_alter_page_setting_defaults', 15, 3 );

Code Snippets Import File
Change Page Settings Defaults Snippet

Last updated: 07/03/2019