HEX
Server: Apache
System: Linux hp3-wp-1011494.hostingp3.local 3.10.0-1160.139.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Nov 3 13:30:41 UTC 2025 x86_64
User: csh2729955 (2121743)
PHP: 7.4.33
Disabled: shell_exec,exec,system,popen,set_time_limit
Upload Files
File: /home/storage/162/3480162/user/htdocs/wp-content/themes/infinity-mag/inc/common-functions-hooks.php
<?php
if (!function_exists('infinity_mag_the_custom_logo')):
/**
 * Displays the optional custom logo.
 *
 * Does nothing if the custom logo is not available.
 *
 * @since infinity-mag 1.0.0
 */
function infinity_mag_the_custom_logo() {
	if (function_exists('the_custom_logo')) {
		the_custom_logo();
	}
}
endif;

if (!function_exists('infinity_mag_body_class')):

/**
 * body class.
 *
 * @since 1.0.0
 */
function infinity_mag_body_class($infinity_mag_body_class) {
	global $post;
	$global_layout       = infinity_mag_get_option('global_layout');
	$input               = '';
	$home_content_status = infinity_mag_get_option('home_page_content_status');
	if (1 != $home_content_status) {
		$input = 'home-content-not-enabled';
	}
	// Check if single.
	if ($post && is_singular()) {
		$post_options = get_post_meta($post->ID, 'infinity-mag-meta-select-layout', true);
		if (empty($post_options)) {
			$global_layout = esc_attr(infinity_mag_get_option('global_layout'));
		} else {
			$global_layout = esc_attr($post_options);
		}
	}
	if ($global_layout == 'left-sidebar') {
		$infinity_mag_body_class[] = 'left-sidebar '.esc_attr($input);
	} elseif ($global_layout == 'no-sidebar') {
		$infinity_mag_body_class[] = 'no-sidebar '.esc_attr($input);
	} else {
		$infinity_mag_body_class[] = 'right-sidebar '.esc_attr($input);

	}
	return $infinity_mag_body_class;
}
endif;

add_action('body_class', 'infinity_mag_body_class');
/**
 * Returns word count of the sentences.
 *
 * @since infinity-mag 1.0.0
 */
if (!function_exists('infinity_mag_words_count')):
function infinity_mag_words_count($length = 25, $infinity_mag_content = null) {
	$length          = absint($length);
	$source_content  = preg_replace('`\[[^\]]*\]`', '', $infinity_mag_content);
	$trimmed_content = wp_trim_words($source_content, $length, '...');
	return $trimmed_content;
}
endif;

if (!function_exists('infinity_mag_simple_breadcrumb')):

/**
 * Simple breadcrumb.
 *
 * @since 1.0.0
 */
function infinity_mag_simple_breadcrumb() {

	if (!function_exists('breadcrumb_trail')) {

		require_once get_template_directory().'/assets/libraries/breadcrumbs/breadcrumbs.php';
	}

	$breadcrumb_args = array(
		'container'   => 'div',
		'show_browse' => false,
	);
	breadcrumb_trail($breadcrumb_args);

}

endif;

if (!function_exists('infinity_mag_custom_posts_navigation')):
/**
 * Posts navigation.
 *
 * @since 1.0.0
 */
function infinity_mag_custom_posts_navigation() {

	$pagination_type = infinity_mag_get_option('pagination_type');

	switch ($pagination_type) {

		case 'default':
			the_posts_navigation();
			break;

		case 'numeric':
			the_posts_pagination();
			break;

		default:
			break;
	}

}
endif;

add_action('infinity_mag_action_posts_navigation', 'infinity_mag_custom_posts_navigation');


if (!function_exists('infinity_mag_excerpt_more') ):

/**
 * Implement read more in excerpt.
 *
 * @since 1.0.0
 *
 * @param string $more The string shown within the more link.
 * @return string The excerpt.
 */
function infinity_mag_excerpt_more() {

	$read_more_text = esc_html(infinity_mag_get_option('read_more_button_text'));

	echo ' <a href="'.esc_url(get_permalink()).'" class="read-more button-fancy -red">'.'<span class="btn-arrow"></span><span class="twp-read-more text">'.esc_html($read_more_text).'</span>'.'</a>';

}

endif;

if (!function_exists('infinity_mag_recommended_plugins')):

/**
 * Recommended plugins
 *
 */
function infinity_mag_recommended_plugins() {
	$infinity_mag_plugins = array(
		array(
		    'name'     => __('Social Share With Floating Bar', 'infinity-mag'),
		    'slug'     => 'social-share-with-floating-bar',
		    'required' => false,
		),
		array(
			'name'      => esc_html__('Demo Import Kit','infinity-mag'),
			'slug'      => 'demo-import-kit',
			'required'  => false,
		),
		array(
			'name'      => esc_html__('Booster Extension','infinity-mag'),
			'slug'      => 'booster-extension',
			'required'  => false,
		),
	);
	$infinity_mag_plugins_config = array(
		'dismissable' => true,
	);

	tgmpa($infinity_mag_plugins, $infinity_mag_plugins_config);
}
endif;
add_action('tgmpa_register', 'infinity_mag_recommended_plugins');


if( !function_exists('infinity_mag_post_floating_nav') ):

    function infinity_mag_post_floating_nav(){

        $default = infinity_mag_get_default_theme_options();
        $ed_floating_next_previous_nav = get_theme_mod( 'ed_floating_next_previous_nav',$default['ed_floating_next_previous_nav'] );

        if( 'post' === get_post_type() && $ed_floating_next_previous_nav ){

            $next_post = get_next_post();
            $prev_post = get_previous_post();

            if( isset( $prev_post->ID ) ){

                $prev_link = get_permalink( $prev_post->ID );?>

                <div class="floating-post-navigation floating-navigation-prev">
                    <?php if( get_the_post_thumbnail( $prev_post->ID,'medium' ) ){ ?>
                            <?php echo wp_kses_post( get_the_post_thumbnail( $prev_post->ID,'medium' ) ); ?>
                    <?php } ?>
                    <a href="<?php echo esc_url( $prev_link ); ?>">
                        <span class="floating-navigation-label"><?php echo esc_html__('Previous post', 'infinity-mag'); ?></span>
                        <span class="floating-navigation-title"><?php echo esc_html( get_the_title( $prev_post->ID ) ); ?></span>
                    </a>
                </div>

            <?php }

            if( isset( $next_post->ID ) ){

                $next_link = get_permalink( $next_post->ID );?>

                <div class="floating-post-navigation floating-navigation-next">
                    <?php if( get_the_post_thumbnail( $next_post->ID,'medium' ) ){ ?>
                        <?php echo wp_kses_post( get_the_post_thumbnail( $next_post->ID,'medium' ) ); ?>
                    <?php } ?>
                    <a href="<?php echo esc_url( $next_link ); ?>">
                        <span class="floating-navigation-label"><?php echo esc_html__('Next post', 'infinity-mag'); ?></span>
                        <span class="floating-navigation-title"><?php echo esc_html( get_the_title( $next_post->ID ) ); ?></span>
                    </a>
                </div>

            <?php
            }

        }

    }

endif;

add_action( 'infinity_mag_navigation_action','infinity_mag_post_floating_nav',10 );