Advanced Customizations

3 min read Updated

These PHP snippets change Origami in ways that Theme Settings and Theme Design do not cover, from content above the logo to the footer credit and the mobile menu. Add them to the functions.php file of a child theme or use the Code Snippets plugin. To add a snippet with Code Snippets:

  1. Install and activate the Code Snippets plugin.
  2. Go to SnippetsAdd New.
  3. Name the snippet and paste the code.
  4. Click Save and Activate.

You can use several snippets together. Each named function must have a unique name, or PHP stops with an error. For CSS changes, see CSS Snippets.

Theme Action Hooks

Origami runs these action hooks as it builds each page. Use them to add your own content without copying a template file.

  • origami_top: at the start of the page, after the opening body tag and the wp_body_open hook.
  • origami_before_page_container: before the page container, the box that holds the header, content and footer widgets.
  • origami_top_page_container: at the top of the page container, above the logo.
  • origami_after_logo and origami_after_logo_wrapper: after the logo, above the menu bar.
  • origami_before_footer_widgets and origami_after_footer_widgets: before and after the Footer widget area. They run only when the area has widgets.
  • origami_bottom_page_container: at the bottom of the page container, below the footer widgets.
  • origami_after_page_container: after the page container.
  • origami_before_footer and origami_after_footer: before and after the copyright line.

This example adds a line of text at the top of every page. Change the text to your own, and style the northfield-notice class with CSS.

add_action( 'origami_top_page_container', function() {
	echo '<p class="northfield-notice">Call Northfield Studio on 302-555-0142</p>';
} );

Below the copyright line, Origami shows a “Theme By SiteOrigin” credit. To change or remove the credit, use the siteorigin_attribution_footer filter. Return an empty string to remove the credit. With SiteOrigin Premium active, the No Attribution Addon removes the credit through this filter while Footer Attribution is on; see Premium Settings.

add_filter( 'siteorigin_attribution_footer', function( $credit ) {
	return '<div class="designed">Site by Northfield Studio</div>';
} );

Mobile Menu

Change the Menu Button Text

On small screens, the Menu button opens the mobile menu, and the panel it opens has the same title. Change Browse to the text you want.

add_filter( 'siteorigin_mobilenav_text', function( $text ) {
	$text['navigate'] = 'Browse';
	return $text;
} );

Remove the Search Field from the Mobile Menu

The mobile menu panel shows a search field above the menu items. This customization removes it. The Header Search setting in Theme Settings does not change the panel.

add_filter( 'siteorigin_mobilenav_search', '__return_false' );

Fonts

Stop Loading Google Fonts

Origami loads fonts from Google Fonts: Terminal Dosis for the site title and the headings of the Archives page template, and any Google font you choose in Theme Design. This customization stops both. Text that uses one of these fonts then shows in a fallback font, such as Arial.

add_filter( 'origami_import_google_fonts', '__return_false' );

add_action( 'wp_enqueue_scripts', function() {
	wp_dequeue_style( 'google-webfonts' );
}, 20 );

Widgets

Use the Block Widget Editor

Origami turns off the block widget editor of WordPress, so AppearanceWidgets shows the classic widgets screen. This customization turns the block widget editor back on.

add_filter( 'siteorigin_settings_disable_new_widget_area', '__return_false' );

Galleries

To link gallery slides to a URL, as Origami Premium did, see the snippet in Galleries.