Advanced Customizations

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 JSON file. A JSON file is provided with each function below. Right click and Save As to download.

Disable Sticky Header On Mobile

The following customization will disable the sticky header below the point that the Mobile Menu Collapse field is set to.

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

Code Snippets Import File
Disable Sticky Header on Mobile Snippet.

Disable Responsive Layout

Disable the responsive layout on mobile devices.

Code Snippets Import File
Disable Responsive Layout on Mobile Devices Snippet.

Disable Smooth Scroll

Disable Corp’s smooth scroll functionality.

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

Code Snippets Import File
Disable Smooth Scroll Snippet.

Display an alternative logo on the site home page.

if ( ! function_exists( 'siteorigin_corp_child_alternative_logo' ) ) :
function siteorigin_corp_child_alternative_logo( $html ) {
if ( is_front_page() )
$html = preg_replace('/<img(.*?)\/>/', '<img class="custom-logo" style="max-width: 75px;" src="https://demo.siteorigin.com/corp/files/2018/04/corp-logo-white-2x.png" alt="siteorigin corp logo" />', $html);

return $html;
}
endif;
add_filter( 'get_custom_logo', 'siteorigin_corp_child_alternative_logo' );

Once you’ve imported the function into Code Snippets, the following values should be replaced.

Image URL: http://demo.siteorigin.com/corp/files/2018/04/corp-logo-white-2x.png
Image ALT tag: siteorigin corp logo
Image maximum width: max-width: 75px;. Here we’ve chosen to add a double sized logo and restrict it’s width with CSS, you can either do the same or just completely remove the style tag: style="max-width: 75px;"

Code Snippets Import File
Disable Responsive Layout on Mobile Devices Snippet.

The following customization will change the logo in the sticky header on scroll.

if ( ! function_exists( 'siteorigin_corp_child_sticky_logo' ) ) :
function siteorigin_corp_child_sticky_logo( $html ) {

$html = preg_replace('/<img(.*?)\/>/', '<img class="alt-logo" style="max-width: 75px;" src="https://demo.siteorigin.com/corp/files/2017/12/corp-logo-2x.png" alt="siteorigin corp logo" /><img class="alt-logo-scroll" style="max-width: 75px;" src="https://siteorigin.com/wp-content/themes/siteorigin-theme/images/logo/[email protected]" alt="siteorigin corp logo" />', $html );

return $html;
}
endif;
add_filter( 'get_custom_logo', 'siteorigin_corp_child_sticky_logo' );

Once you’ve imported the function into Code Snippets, the following values should be replaced.

Regular Logo Image URL: http://demo.siteorigin.com/corp/files/2017/12/corp-logo-2x.png
Sticky Logo Image URL: https://siteorigin.com/wp-content/themes/siteorigin-theme/images/logo/[email protected]
Image ALT tags: siteorigin corp logo
Image maximum widths: max-width: 75px;. Here we’ve chosen to add a double sized logo and restrict it’s width with CSS, you can either do the same or just completely remove the style tag: style="max-width: 75px;"

Be sure to leave the CSS class names in place as they’re being targetted from within the theme’s stylesheet.

Code Snippets Import File
Sticky Logo Snippet.

If you’d like to change the logo in the sticky header on scroll and set an alternative logo for the home page, you can use this customization.

if ( ! function_exists( 'siteorigin_corp_child_alt_sticky_logo' ) ) :
function siteorigin_corp_child_alt_sticky_logo( $html ) {
if ( is_front_page() ) {
$html = preg_replace('/<img(.*?)\/>/', '<img class="alt-logo" style="max-width: 75px;" src="https://demo.siteorigin.com/corp/files/2018/04/corp-logo-white-2x.png" alt="siteorigin corp logo" /><img class="alt-logo-scroll" style="max-width: 75px;" src="https://siteorigin.com/wp-content/themes/siteorigin-theme/images/logo/[email protected]" alt="siteorigin corp logo" />', $html );
} else {
$html = preg_replace('/<img(.*?)\/>/', '<img class="alt-logo" style="max-width: 75px;" src="https://demo.siteorigin.com/corp/files/2017/12/corp-logo-2x.png" alt="siteorigin corp logo" /><img class="alt-logo-scroll" style="max-width: 75px;" src="https://siteorigin.com/wp-content/themes/siteorigin-theme/images/logo/[email protected]" alt="siteorigin corp logo" />', $html );
}

return $html;
}
endif;
add_filter( 'get_custom_logo', 'siteorigin_corp_child_alt_sticky_logo' );

Once you’ve imported the function into Code Snippets, the following values should be replaced.

Home Page Regular Logo Image URL: http://demo.siteorigin.com/corp/files/2018/04/corp-logo-white-2x.png
Home Page Sticky Logo Image URL: https://siteorigin.com/wp-content/themes/siteorigin-theme/images/logo/[email protected]
Regular Logo Image URL: http://demo.siteorigin.com/corp/files/2017/12/corp-logo-2x.png
Sticky Logo Image URL: https://siteorigin.com/wp-content/themes/siteorigin-theme/images/logo/[email protected]
Image ALT tags: siteorigin corp logo
Image maximum widths: max-width: 75px;. Here we’ve chosen to add a double sized logo and restrict it’s width with CSS, you can either do the same or just completely remove the style tag: style="max-width: 75px;"

Be sure to leave the CSS class names in place as they’re being targetted from within the theme’s stylesheet.

Code Snippets Import File
Alternative Home Page and Sticky Logo Snippet.

Adjust Sticky Header Logo Scaling

The sticky header and logo scaling settings can be found at AppearanceCustomizeHeader. 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( 'siteorigin_corp_child_logo_scaling' ) ) :
function siteorigin_corp_child_logo_scaling( $scale ) {
	return 0.755;
}
add_filter( 'siteorigin_corp_logo_sticky_scale', 'siteorigin_corp_child_logo_scaling' );
endif;

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

Display Logo and Site Title

By default, it isn’t possible to display the site title and a logo. If you add a logo it replaces the site title. This function will allow you to display both the logo and site title.

Add the following to AppearanceCustom CSS using SiteOrigin CSS or the Custom CSS location of your choosing:

.site-header .site-branding .custom-logo-link {
	display: inline-block;
	margin-right: 5px;
	vertical-align: middle;
}

.site-header .site-branding .site-title {
	display: inline-block;
	line-height: 0;
	vertical-align: middle;
}

Code Snippets Import File
Display Logo and Site Title.

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:

function siteorigin_corp_child_alter_page_setting_defaults( $defaults, $type, $id ) {
	$defaults['layout'] = 'no-sidebar';

	return $defaults;
}
add_filter( 'siteorigin_page_settings_defaults', 'siteorigin_corp_child_alter_page_setting_defaults', 15, 3 );

To view the available settings and values, please see the page-settings.php file on GitHub.

Code Snippets Import File
Page Settings Defaults.