Home>Themes>Unwind>Unwind Documentation>Advanced Customizations

Advanced Customizations

Below you’ll find advanced customizations that aren’t included in theme settings. These customizations can be added to a child theme functions.php file or 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.

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

	return $defaults;
}
add_filter( 'siteorigin_page_settings_defaults', 'siteorigin_unwind_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. Unzip the JSON file before importing into Code Snippets.

Change the Continue Reading Button Text

The below function can be used to change the Continue reading text if Post Content is set to Full Post.

if ( ! function_exists( 'siteorigin_unwind_read_more_link' ) ) :
/**
 * Filter the read more link.
 */
function siteorigin_unwind_read_more_link() {
	$read_more_text = esc_html__( 'Continue reading', 'siteorigin-unwind' );
		return '

<div class="more-link-wrapper"><a class="more-link" href="' . get_permalink() . '"><span class="more-text">' . $read_more_text . '</span></a></div>';
}
endif;
add_filter( 'the_content_more_link', 'siteorigin_unwind_read_more_link' );

The Grid, Alternate, and Masonry layouts automatically use the excerpt. If you’ve set Post Content to Post Excerpt and have enabled Post Excerpt Read More Link or if you’re using the Grid, Alternate or Masonry layouts and have enabled the Post Excerpt Read More Link setting, the following function can be used to change the Continue reading text.

if ( ! function_exists( 'siteorigin_unwind_excerpt' ) ) :
/**
 * Outputs the excerpt.
 */
function siteorigin_unwind_excerpt() {

	if ( ( siteorigin_setting( 'blog_archive_content' ) == 'excerpt' || siteorigin_setting( 'blog_archive_layout' ) == 'grid' || siteorigin_setting( 'blog_archive_layout' ) == 'alternate' ) && siteorigin_setting( 'blog_excerpt_more', true ) && ! is_search() ) {
		$read_more_text = esc_html__( 'Continue reading', 'siteorigin-unwind' );
		$read_more_text = '

<div class="more-link-wrapper"><a class="more-link" href="' . esc_url( get_permalink() ) . '"><span class="more-text">' . $read_more_text . '</span></a></div>';
	} else {
		$read_more_text = '';
	}
	$ellipsis = '...';
	$length = siteorigin_setting( 'blog_excerpt_length' );
	$excerpt = explode( ' ', get_the_excerpt(), $length );

	if ( $length ) {

		if ( count( $excerpt ) >= $length ) {
			array_pop( $excerpt );
			$excerpt = '

' . implode( " ", $excerpt ) . $ellipsis . '

' . $read_more_text;
		} else {
			$excerpt = '

' . implode( " ", $excerpt ) . $ellipsis . '

';
		}

	} else {

		$excerpt = get_the_excerpt();

	}

	$excerpt = preg_replace( '`\[[^\]]*\]`','', $excerpt );

	echo $excerpt;

}
endif;

Adjust the Number of Upsell Products Displayed on the Single Product Page

if ( ! function_exists( 'siteorigin_unwind_woocommerce_output_upsells' ) ) {
	/*
	 * Change number of upsells output.
	 *
	 * @link https://docs.woocommerce.com/document/change-number-of-upsells-output/
	 */
	function siteorigin_unwind_woocommerce_output_upsells() {
		woocommerce_upsell_display( 4, 4 );
	}
}

Add Product Upsells to the Cart Page

function siteorigin_unwind_cart_collaterals() {
	add_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' );
}
add_action( 'init', 'siteorigin_unwind_cart_collaterals' );

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More