Advanced Customizations
Some changes need PHP code. This page has code for changes that the Vantage settings do not cover. Add the code to the functions.php file of a child theme, or use the Code Snippets plugin.
Add Code With Code Snippets
- Install and activate the Code Snippets plugin.
- Go to SnippetsAdd New.
- Enter a name for the snippet.
- Paste the code into the code field.
- Click Save Changes and Activate.
Some snippets below have an import file. To use it, unzip it if needed, then go to SnippetsImport.
Use Self-Hosted Fonts
The font settings of Vantage list Google Fonts. By default, Vantage imports the fonts you choose from Google. This filter stops the import. Vantage still sets the font-family of each font, so you can host the font files yourself.
add_filter( 'vantage_import_google_fonts', '__return_false' );
Change From Google Fonts to Bunny Fonts
Bunny Fonts offers the same fonts as Google Fonts from a different service. This filter changes the address that Vantage uses to import the fonts.
add_filter( 'siteorigin_web_font_url', function( $url ) {
return 'https://fonts.bunny.net/css';
} );Change the Page Settings Defaults
The Page Settings box has default values. This filter changes them. For example, this code makes No Sidebar the default Page Layout:
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 );The filter gets the default values, the type (such as page or post) and the ID. These are the setting names and their values:
layout:default,no-sidebar,full-widthorfull-width-sidebar.page_title,masthead_marginandfooter_margin:trueorfalse.hide_mastheadandhide_footer_widgets:trueorfalse.featured_image:trueorfalse. This setting is only for pages.
You can also read the vantage_page_settings and vantage_setup_page_setting_defaults functions in inc/settings.php on GitHub.
Code Snippets import file
Page Settings Defaults. Unzip the file before you import it.
Stop the Vantage Mobile Menu on the wpForo Menu
The Vantage mobile menu changes the menus that use a theme location, and this includes the wpForo menu. This code stops it from changing the wpForo menu, and then turns it back on for the menus that follow.
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 );
remove_filter( 'wp_page_menu', 'siteorigin_mobilenav_nav_filter', 10 );
}
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 );
function vantage_wpforo_menu_restore( $nav_menu ) {
if ( function_exists( 'siteorigin_mobilenav_nav_filter' ) && ! has_filter( 'wp_nav_menu', 'siteorigin_mobilenav_nav_filter' ) ) {
add_filter( 'wp_nav_menu', 'siteorigin_mobilenav_nav_filter', 10, 2 );
add_filter( 'wp_page_menu', 'siteorigin_mobilenav_nav_filter', 10, 2 );
}
return $nav_menu;
}
add_filter( 'wp_nav_menu', 'vantage_wpforo_menu_restore', 11 );
add_filter( 'wp_page_menu', 'vantage_wpforo_menu_restore', 11 );Turn On the Widgets Block Editor
Vantage uses the classic Widgets screen. To use the block editor for widgets, add this filter:
add_filter( 'siteorigin_settings_disable_new_widget_area', '__return_false' );
Code Snippets import file
Enable Widgets Block Editor. Right-click the link and save the file.
Remove the Archive Title Prefix
You do not need code for this. Go to AppearanceCustomizeTheme SettingsBlog and turn off Blog Archive Title Prefix. See Blog.
Turn Off the Page Slider
This code removes the slider from the home page and from all other pages. Add it to a child theme or to Code Snippets. Both load before the Vantage functions.php file.
function vantage_render_slider() {
// Show no slider.
}Remove Font Awesome
Vantage loads Font Awesome for its icons. This code stops Font Awesome from loading, for example when you use another icon library.
function vantage_child_remove_fontawesome() {
wp_dequeue_style( 'font-awesome-v4-shims' );
wp_dequeue_style( 'font-awesome' );
}
add_action( 'wp_enqueue_scripts', 'vantage_child_remove_fontawesome', 20 );The icons that use Font Awesome stop showing. These are the menu icons, the icons of the Vantage Circle Icon Widget and the Vantage Social Media Widget, and the mini cart icon. Icons that you replaced with your own image are not affected.
Turn Off Breadcrumbs
To turn off all breadcrumbs with one filter, see Breadcrumbs.