HEX
Server: LiteSpeed
System: Linux linux31.centraldnserver.com 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User: salamatk (1501)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open
Upload Files
File: /home/salamatk/takarzan.ir/wp-content/themes/dropshipping-shop/inc/core/template-functions.php
<?php
/**
 * Functions which enhance the theme by hooking into WordPress
 *
 * @package Dropshipping Shop
 */

/**
 * Add customizer default values.
 *
 * @param array $default_options
 * @return array
 */
function dropshipping_shop_customizer_add_defaults( $default_options) {
	$defaults = array(
		// Excerpt Options
		'dropshipping_shop_excerpt_length'    => 15,
	);

	$updated_defaults = wp_parse_args( $defaults, $default_options );

	return $updated_defaults;
}
add_filter( 'dropshipping_shop_customizer_defaults', 'dropshipping_shop_customizer_add_defaults' );

/**
 * Returns theme mod value saved for option merging with default option if available.
 * @since 1.0
 */
function dropshipping_shop_gtm( $option ) {
	// Get our Customizer defaults
	$defaults = apply_filters( 'dropshipping_shop_customizer_defaults', true );

	return isset( $defaults[ $option ] ) ? get_theme_mod( $option, $defaults[ $option ] ) : get_theme_mod( $option );
}

if ( ! function_exists( 'dropshipping_shop_excerpt_length' ) ) :
	/**
	 * Sets the post excerpt length to n words.
	 *
	 * function tied to the excerpt_length filter hook.
	 * @uses filter excerpt_length
	 */
	function dropshipping_shop_excerpt_length( $length ) {
		if ( is_admin() ) {
			return $length;
		}

		// Getting data from Theme Options
		$length	= dropshipping_shop_gtm( 'dropshipping_shop_excerpt_length' );

		return absint( $length );
	} // dropshipping_shop_excerpt_length.
endif;
add_filter( 'excerpt_length', 'dropshipping_shop_excerpt_length', 999 );