HEX
Server: Apache
System: Linux server7 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64
User: k8148-2 (1324)
PHP: 8.2.30
Disabled: show_source, highlight_file, apache_child_terminate, apache_get_modules, apache_note, apache_setenv, virtual, dl, posix_getpwnam, posix_getpwuid, posix_mkfifo, posix_mknod, posix_setpgid, posix_setsid, posix_setuid, posix_uname, proc_nice, openlog, syslog, pfsockopen, system, shell_exec, passthru, popen, proc_open, exec
Upload Files
File: /var/www/k8148-2/htdocs/www.sport-roth.at/wp-content/themes/old_daniel/functions.php
<?php
/**
 * Daniel functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package Daniel
 */

if ( ! function_exists( 'daniel_setup' ) ) :
	/**
	 * Sets up theme defaults and registers support for various WordPress features.
	 *
	 * Note that this function is hooked into the after_setup_theme hook, which
	 * runs before the init hook. The init hook is too late for some features, such
	 * as indicating support for post thumbnails.
	 */
	function daniel_setup() {
		/*
		 * Make theme available for translation.
		 * Translations can be filed in the /languages/ directory.
		 * If you're building a theme based on Daniel, use a find and replace
		 * to change 'daniel' to the name of your theme in all the template files.
		 */
		load_theme_textdomain( 'daniel', get_template_directory() . '/languages' );

		// Add default posts and comments RSS feed links to head.
		add_theme_support( 'automatic-feed-links' );

		/*
		 * Let WordPress manage the document title.
		 * By adding theme support, we declare that this theme does not use a
		 * hard-coded <title> tag in the document head, and expect WordPress to
		 * provide it for us.
		 */
		add_theme_support( 'title-tag' );

		/*
		 * Enable support for Post Thumbnails on posts and pages.
		 *
		 * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
		 */
		add_theme_support( 'post-thumbnails' );

		/**
		* Add Image Size
		*/
		add_image_size('daniel_size_550x350',550,350,true);

		/**
		* Add Editor style
		*/
		add_theme_support( 'editor-styles' );
		add_editor_style('assets/css/editor-style.css');

		// This theme uses wp_nav_menu() in one location.
		register_nav_menus( array(
			'mainmenu' => esc_html__( 'Primary', 'daniel' ),
			'footermenu' => esc_html__( 'Footer Menu', 'daniel' ),
		) );

		/*
		 * Switch default core markup for search form, comment form, and comments
		 * to output valid HTML5.
		 */
		add_theme_support( 'html5', array(
			'search-form',
			'comment-form',
			'comment-list',
			'gallery',
			'caption',
		) );

		// Set up the WordPress core custom background feature.
		add_theme_support( 'custom-background', apply_filters( 'daniel_custom_background_args', array(
			'default-color' => 'ffffff',
			'default-image' => '',
		) ) );

		// Add theme support for selective refresh for widgets.
		add_theme_support( 'customize-selective-refresh-widgets' );

		/**
		 * Add support for core custom logo.
		 *
		 * @link https://codex.wordpress.org/Theme_Logo
		 */
		add_theme_support( 'custom-logo', array(
			'height'      => 250,
			'width'       => 250,
			'flex-width'  => true,
			'flex-height' => true,
		) );
	}
endif;
add_action( 'after_setup_theme', 'daniel_setup' );

/**
 * Set the content width in pixels, based on the theme's design and stylesheet.
 *
 * Priority 0 to make it available to lower priority callbacks.
 *
 * @global int $content_width
 */
function daniel_content_width() {
	// This variable is intended to be overruled from themes.
	// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
	// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
	$GLOBALS['content_width'] = apply_filters( 'daniel_content_width', 640 );
}
add_action( 'after_setup_theme', 'daniel_content_width', 0 );

/**
 * Register custom fonts.
 */
 if ( !function_exists( 'daniel_fonts_url' ) ) :
	function daniel_fonts_url() {
		$fonts_url = '';
		$fonts     = array();
		$subsets   = 'latin,latin-ext';

		/* translators: If there are characters in your language that are not supported by Open Sans, translate this to 'off'. Do not translate into your own language. */
		if ( 'off' !== _x( 'on', 'Roboto font: on or off', 'daniel' ) ) {
			$fonts[] = 'Roboto:300,400,500,700';
		}

		/* translators: If there are characters in your language that are not supported by Open Sans, translate this to 'off'. Do not translate into your own language. */
		if ( 'off' !== _x( 'on', 'Poppins font: on or off', 'daniel' ) ) {
			$fonts[] = 'Poppins:300,400,500,600,700';
		}
		
		if ( $fonts ) {
			$fonts_url = add_query_arg( array(
				'family' => urlencode( implode( '|', $fonts ) ),
				'subset' => urlencode( $subsets ),
			), 'https://fonts.googleapis.com/css' );
		}

		return $fonts_url;
	}
endif;

/**
 * Enqueue scripts and styles.
 */
function daniel_scripts() {

	wp_enqueue_style('daniel-font', daniel_fonts_url());

	wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/css/font-awesome.min.css' );
	wp_enqueue_style('htflexboxgrid', get_template_directory_uri() . '/assets/css/htflexboxgrid.css');
	wp_enqueue_style( 'daniel-style', get_stylesheet_uri() );

	wp_enqueue_script( 'slick' );
	wp_enqueue_script( 'woolentor-widgets-scripts' );
	wp_enqueue_script( 'daniel-main', get_template_directory_uri() . '/assets/js/main.js', array(), '1.0.0', true );
	wp_enqueue_script( 'daniel-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), '20151215', true );
	wp_enqueue_script( 'daniel-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), '20151215', true );

	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
		wp_enqueue_script( 'comment-reply' );
	}
}
add_action( 'wp_enqueue_scripts', 'daniel_scripts' );

/**
 * Implement the Custom Header feature.
 */
require get_template_directory() . '/inc/custom-header.php';

/**
 * Custom template tags for this theme.
 */
require get_template_directory() . '/inc/template-tags.php';

/**
 * Functions which enhance the theme by hooking into WordPress.
 */
require get_template_directory() . '/inc/template-functions.php';

/**
 * Theme Helpers Functions.
 */
require get_template_directory() . '/inc/helpers-functions.php';

/**
 * Customizer additions.
 */
require get_template_directory() . '/inc/customizer/customizer.php';
require get_template_directory() . '/inc/customizer/sanitization-callbacks.php';

/**
 * Widgets registrar.
 */
require get_template_directory() . '/inc/widgets_register.php';

/**
 * Load Jetpack compatibility file.
 */
if ( defined( 'JETPACK__VERSION' ) ) {
	require get_template_directory() . '/inc/jetpack.php';
}

/**
 * Load WooCommerce compatibility file.
 */
if ( class_exists( 'WooCommerce' ) ) {
	require get_template_directory() . '/inc/woocommerce.php';
}

/**
 * Load TGM plugins
 */
require get_template_directory() . '/inc/libs/tgm-plugin/init.php';

/*
 Demo Import file call
*/
require get_template_directory().'/inc/demo-import.php';

/**
* Pagination 
*/
if( !function_exists('daniel_blog_pagination') ){
	function daniel_blog_pagination(){
		?>
		<div class="ht-col-xs-12"><div class="post-pagination">
			<?php
				the_posts_pagination(array(
					'prev_text'          => '<i class="fa fa-angle-left"></i>',
					'next_text'          => '<i class="fa fa-angle-right"></i>',
					'type'               => 'list'
				));
			?>
		</div></div>
		<?php
	}
}

// Footer class
function daniel_footer_class_add( $footerclass ){
	$footer_layout = daniel_get_option( 'daniel_footer_layout', 'footerlayout', '1' );
	if( $footer_layout == '2' ){
		$footerclass = 'footer_area_two';
	}
	return $footerclass;
}
add_filter( 'daniel_footer_class', 'daniel_footer_class_add', 1 );

add_filter( 'wc_product_has_unique_sku', '__return_false', PHP_INT_MAX );


function kia_woocommerce_order_item_name( $name, $item ){

    $product_id = $item['product_id'];
    $tax = 'product_cat';

    $terms = wp_get_post_terms( $product_id, $tax, array( 'fields' => 'names' ) );

    if( $terms && ! is_wp_error( $terms )) {
        $taxonomy = get_taxonomy($tax);
        $name .= '<br><label>' . $taxonomy->label . ': </label>' . implode( ', ', $terms );
    }

    return $name;
}
add_filter( 'woocommerce_order_item_name', 'kia_woocommerce_order_item_name', 10, 2 );

function remove_unvetted_authors( $query ) {
	global $pagenow;
	if( is_admin() && 'edit.php' == $pagenow ){
        $user_ids = get_users( [
            'role'   => 'administrator',
            'fields' => 'ID'
        ] );

        $query->set( 'author__in', $user_ids );
    }
}
add_action( 'pre_get_posts', 'remove_unvetted_authors' );

function exclude_category($query) {
    if ( $query->is_home() || is_category() || is_search() || is_archive()) {
        $query->set( 'author__not_in', 20 );
    }
	return $query;
}
add_filter( 'pre_get_posts', 'exclude_category' );