Advanced Customizations

Below you’ll find advanced customizations that aren’t included in theme settings. These customizations 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 SnippetsAdd New.
  3. Name the snippet as you’d like to. Copy and paste the snippet into the provided field. Save and Activate.

Disable Google Fonts

The following filter allows you to choose the Google Fonts you’d like to use in the Vantage Customizer settings but self-host the font families. Vantage will output the necessary styles but won’t import the font from Google.

add_filter( 'vantage_import_google_fonts', '__return_false' );

Change from Google to Bunny Fonts

Bunny Fonts is GDPR compatible.

add_filter( 'siteorigin_web_font_url', function( $url ) {
	return 'https://fonts.bunny.net/css';
} );

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 vantage_child_alter_page_setting_defaults( $defaults, $type, $id ) {
	$defaults['layout'] = 'no-sidebar';

	return $defaults;
}
add_filter( 'siteorigin_page_settings_defaults', 'vantage_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. (The JSON file must be unzipped before importing into Code Snippets.)

Prevent Vantage Mobile Menu from Targeting wpForo Menu

function vantage_wpforo_menu_fix( $nav_menu, $args ) {
	$args = (object) $args;

	if ( $args->theme_location == 'wpforo-menu' ) {
		remove_filter( 'wp_nav_menu', 'siteorigin_mobilenav_nav_filter', 10, 2 );
		remove_filter( 'wp_page_menu', 'siteorigin_mobilenav_nav_filter', 10, 2 );
	}

	return $nav_menu;
}
add_filter( 'wp_nav_menu', 'vantage_wpforo_menu_fix', 1, 2 );
add_filter( 'wp_page_menu', 'vantage_wpforo_menu_fix', 1, 2 );

Code Snippets Import File
wpForo Compatibility Snippet (The JSON file must be unzipped before importing into Code Snippets.)

Enable Widgets Block Editor

Vantage opts out of the Widgets Block Editor. You can opt-in using the following filter.

add_filter( 'siteorigin_settings_disable_new_widget_area', '__return_false' );

Code Snippets Import File
Enable Widgets Block Editor Snippet (Right Click and Save As)

Remove the Archive Title Prefix

if ( ! function_exists( 'vantage_get_archive_title' ) ) :
/**
 * Return the archive title depending on which page is being displayed.
 *
 * @since vantage 1.0
 */
function vantage_get_archive_title() {
	global $wp_query;
	$prefix = '';
	$title = '';

	if ( is_category() ) {
		$prefix = __( '', 'vantage' );
		$title = '<span>' . single_cat_title( '', false ) . '</span>';

	} elseif ( is_tag() ) {
		$prefix = __( '', 'vantage' );
		$title = '<span>' . single_tag_title( '', false ) . '</span>';

	} elseif ( is_author() ) {
		the_post();
		$prefix = __( '', 'vantage' );
		$title = '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>';
		rewind_posts();
	} elseif ( is_day() ) {
		$prefix = __( '', 'vantage' );
		$title = '<span>' . get_the_date() . '</span>';

	} elseif ( is_month() ) {
		$prefix = __( '', 'vantage' );
		$title = '<span>' . get_the_date( 'F Y' ) . '</span>';

	} elseif ( is_year() ) {
		$prefix = __( '', 'vantage' );
		$title = '<span>' . get_the_date( 'Y' ) . '</span>';

	} elseif ( ! empty( $wp_query->query_vars['taxonomy'] ) ) {
		$value = get_query_var( $wp_query->query_vars['taxonomy'] );
		$term = get_term_by( 'slug',$value,$wp_query->query_vars['taxonomy'] );
		$tax = get_taxonomy( $wp_query->query_vars['taxonomy'] );
		$prefix = $tax->label . ':';
		$title = $term->name;
	}

	if ( ! empty( $title ) ) {
		$title = sprintf( __( '%s %s', 'vantage' ), siteorigin_setting( 'blog_archive_prefix_title' ) ? $prefix : '', $title );
	} else {
		$title = __( 'Archives', 'vantage' );
	}

	return apply_filters( 'vantage_archive_title', $title );
}
endif;

Disable the Vantage Page Slider

if ( ! function_exists( 'vantage_render_slider' ) ) {
	function vantage_render_slider() {
		$vantage_is_main_slider = false;
	}
}

Vantage Single Post Navigation in Same Category