<?php 
/**
 * phnewspaper functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package phnewspaper
 */

if ( ! defined( '_phnewspaper_VERSION' ) ) {
	// Replace the version number of the theme on each release.
	define( '_phnewspaper_VERSION', '1.0' );
}

if ( ! function_exists( 'phnewspaper_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 phnewspaper_setup() {
		/*
		 * Make theme available for translation.
		 * Translations can be filed in the /languages/ directory.
		 * If you're building a theme based on phnewspaper, use a find and replace
		 * to change 'ph-news-paper' to the name of your theme in all the template files.
		 */
		load_theme_textdomain( 'ph-news-paper', get_template_directory() . '/languages' );

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

		// Align wide support
		add_theme_support( 'align-wide' );

		/*
		 * 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' );

		// This theme uses wp_nav_menu() in one location.
		register_nav_menus(
			array(
				'menu-1' => esc_html__( 'Primary', 'ph-news-paper' ),
				'menu-top' => esc_html__( 'Top', 'ph-news-paper' ),
				'mobile' => esc_html__( 'Mobile Menu', 'ph-news-paper' ),
				'social' => esc_html__( 'Social Networks', 'ph-news-paper' ),
			)
		);

		/*
		 * 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',
				'style',
				'script',
			)
		);

		// Set up the WordPress core custom background feature.
		// Set up the WordPress core custom background feature.
		add_theme_support(
			'custom-background',
			apply_filters(
				'pixanews_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,
			)
		);
		
		add_image_size( 'phnewspaper-thumbnail-4x3', '600', '450', true );
		add_image_size( 'phnewspaper-thumbnail-4x4', '600', '600', true );
		
	}
endif;
add_action( 'after_setup_theme', 'phnewspaper_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 phnewspaper_content_width() {
	$GLOBALS['content_width'] = apply_filters( 'phnewspaper_content_width', 768 );
}
add_action( 'after_setup_theme', 'phnewspaper_content_width', 0 );

/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
function phnewspaper_widgets_init() {
	register_sidebar(
		array(
			'name'          => esc_html__( 'Sidebar', 'ph-news-paper' ),
			'id'            => 'sidebar-1',
			'description'   => esc_html__( 'Add widgets here.', 'ph-news-paper' ),
			'before_widget' => '<section id="%1$s" class="widget %2$s">',
			'after_widget'  => '</section>',
			'before_title'  => '<h2 class="widget-title">',
			'after_title'   => '</h2>',
		)
	);
	register_sidebar(
		array(
			'name'          => esc_html__( 'Footer Widgets Area 1', 'ph-news-paper' ),
			'id'            => 'footer-1',
			'description'   => esc_html__( 'Add widgets here.', 'ph-news-paper' ),
			'before_widget' => '<section id="%1$s" class="widget %2$s">',
			'after_widget'  => '</section>',
			'before_title'  => '<div class="widget-title">',
			'after_title'   => '</div>',
		)
	);
	register_sidebar(
		array(
			'name'          => esc_html__( 'Footer Widgets Area 2', 'ph-news-paper' ),
			'id'            => 'footer-2',
			'description'   => esc_html__( 'Add widgets here.', 'ph-news-paper' ),
			'before_widget' => '<section id="%1$s" class="widget %2$s">',
			'after_widget'  => '</section>',
			'before_title'  => '<div class="widget-title">',
			'after_title'   => '</div>',
		)
	);
	register_sidebar(
		array(
			'name'          => esc_html__( 'Footer Widgets Area 3', 'ph-news-paper' ),
			'id'            => 'footer-3',
			'description'   => esc_html__( 'Add widgets here.', 'ph-news-paper' ),
			'before_widget' => '<section id="%1$s" class="widget %2$s">',
			'after_widget'  => '</section>',
			'before_title'  => '<div class="widget-title">',
			'after_title'   => '</div>',
		)
	);
}
add_action( 'widgets_init', 'phnewspaper_widgets_init' );

/**
 * Enqueue scripts and styles.
 */
function phnewspaper_scripts() {
	wp_enqueue_style( 'phnewspaper-style', get_stylesheet_uri(), array(), _phnewspaper_VERSION );
	wp_enqueue_style('bootstrap', get_template_directory_uri() . '/lib/bootstrap/bootstrap.min.css'); 
	wp_enqueue_style('fontawesome', get_template_directory_uri() . '/lib/font-awesome/css/all.min.css'); 
	wp_enqueue_style('acme-ticker-css', get_template_directory_uri() . '/lib/acmeticker/css/style.min.css'); 
	wp_enqueue_style('owl-carousel-css', get_template_directory_uri() . '/lib/owl-carousel/dist/assets/owl.carousel.min.css'); 
	wp_enqueue_style('owl-carousel-theme-css', get_template_directory_uri() . '/lib/owl-carousel/dist/assets/owl.theme.default.min.css'); 
	wp_enqueue_style('sidr-light-css', get_template_directory_uri() . '/lib/sidr/stylesheets/jquery.sidr.light.min.css'); 
	wp_enqueue_style('phnewspaper-primary-font', '//fonts.googleapis.com/css2?family=Roboto:wght@100;200;300;400;500;600;700;900&display=swap' );
	wp_enqueue_style('phnewspaper-secondary-font', '//fonts.googleapis.com/css2?family=Oswald:wght@300;400;500;600;700&display=swap' );
	wp_enqueue_style('phnewspaper-core', get_template_directory_uri() . '/design-files/core/core.css'); 
	wp_enqueue_style('phnewspaper-header', get_template_directory_uri() . '/design-files/header/'.esc_html(get_theme_mod('phnewspaper-header-style','style2')).'/header.css'); 
	wp_enqueue_style('phnewspaper-blog-style1', get_template_directory_uri() . '/design-files/blog-style/blog-style1.css'); 
	wp_enqueue_style('phnewspaper-single', get_template_directory_uri() . '/design-files/single/single.css');
	wp_enqueue_style('phnewspaper-sidebar', get_template_directory_uri() . '/design-files/sidebar/sidebar.css'); 
	wp_enqueue_style('phnewspaper-footer', get_template_directory_uri() . '/design-files/footer/footer.css'); 
	wp_enqueue_style('phnewspaper-featured-modules', get_template_directory_uri() . '/design-files/featured-modules/featured-modules.css'); 

	wp_enqueue_script( 'phnewspaper-navigation', get_template_directory_uri() . '/js/navigation.js', array(), _phnewspaper_VERSION, true );
	wp_enqueue_script( 'acme-ticker', get_template_directory_uri() . '/lib/acmeticker/js/acmeticker.min.js', array('jquery'), '', true );
	wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/lib/owl-carousel/dist/owl.carousel.js', array('jquery'), '2.3.4', true );
	wp_enqueue_script( 'sidr', get_template_directory_uri() . '/lib/sidr/jquery.sidr.min.js', array('jquery'), '2.2.1', true );
	wp_enqueue_script( 'phnewspaper-theme-js', get_template_directory_uri() . '/js/theme.js', array('sidr','owl-carousel'), _phnewspaper_VERSION, true );


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

/**
 * Filter the excerpt length to 50 words.
 *
 * @param int $length Excerpt length.
 * @return int 
 */
function phnewspaper_excerpt_length( $length ) {
		if (!is_admin() ) { 
			return 30; 
		} 
		return $length;

}
add_filter( 'excerpt_length', 'phnewspaper_excerpt_length', 999 );

function phnewspaper_excerpt_more( $more ) {
	if (!is_admin() ) {
		return '....'; 
	} 
	return $more;

}
add_filter( 'excerpt_more', 'phnewspaper_excerpt_more' );

/**
 * Function to wrap the entire site in a container and bootstrap row.
 *
 */
function phnewspaper_after_header_divs() {
    // Check if Elementor is active and the current page uses an Elementor template
    $is_elementor_template = defined('ELEMENTOR_PATH') && class_exists('Elementor\Plugin') && is_page_template('elementor_header_footer');

    // Output opening container div if not an Elementor template
    if (!$is_elementor_template) {
        echo '<div class="container">';
		echo '<div class="row">';
    }


}
add_action('phnewspaper_after_header', 'phnewspaper_after_header_divs'); 

function phnewspaper_before_footer_divs() {
   
    // Check if Elementor is active and the current page uses an Elementor template
    $is_elementor_template = defined('ELEMENTOR_PATH') && class_exists('Elementor\Plugin') && is_page_template('elementor_header_footer');

    // Output closing container div if not an Elementor template
    if (!$is_elementor_template) {
		echo '</div><!-- .row -->';
        echo '</div><!-- .container -->';
    }
}
add_action('phnewspaper_before_footer', 'phnewspaper_before_footer_divs');



/**
 * Function to wrap the entire site in a container and bootstrap row.
 *
 */
function phnewspaper_before_loop_divs() {
	$layout = "grid-".phnewspaper_blog_layout_setting();
	?>
		<div class="row grid-row <?php echo esc_attr($layout); ?>"><?php
}
add_action('phnewspaper_before_loop','phnewspaper_before_loop_divs'); 

function phnewspaper_after_loop_divs() {
	?></div><!--#.grid-row--><?php
}
add_action( 'phnewspaper_after_loop', 'phnewspaper_after_loop_divs' );

/**
 * Featured Ticker, Carousel & Other Modules
 */
function phnewspaper_insert_ticker() {
		get_template_part( 'template-parts/featured-modules/acme-ticker' );
}
add_action('phnewspaper_after_header','phnewspaper_insert_ticker'); 
 
function phnewspaper_insert_carousel() {
	if (is_home())
		get_template_part( 'template-parts/featured-modules/owl-carousel' );
}
add_action('phnewspaper_after_header','phnewspaper_insert_carousel'); 

function phnewspaper_insert_featured_modules() {
	if (is_home()) :
		$i = 0;
		for ($i = 1; $i < 3; $i++) :
			phnewspaper_display_featured_module( get_theme_mod( 'phnewspaper-fa-style-'.$i, 'style1' ), get_theme_mod('phnewspaper-fa-enable-'.$i, 0) ,get_theme_mod( 'phnewspaper-fa-cat-'.$i, 0 ), get_theme_mod( 'phnewspaper-fa-show-title-'.$i, true ));
		endfor;
	endif;	
}
add_action('phnewspaper_after_header','phnewspaper_insert_featured_modules'); 


/**
 * Function to alter the width of sidebar and content area based on diff pages.
 *
 */
function phnewspaper_sidebar_setting() {
	if (is_search())	
		$setting = get_theme_mod('phnewspaper-primary-width-search', 'no-sidebar-narrow-primary');
	if (is_single())
		$setting = get_theme_mod('phnewspaper-primary-width-single-post', 'no-sidebar-narrow-primary');
	if (is_page())
		$setting = get_theme_mod('phnewspaper-primary-width-page', 'no-sidebar-narrow-primary');
	if (is_archive())
		$setting = get_theme_mod('phnewspaper-primary-width-archives', 'no-sidebar-narrow-primary');
	if (is_home())
		$setting = get_theme_mod('phnewspaper-primary-width-home', 'right-sidebar');	 
	return $setting;
}
	
function phnewspaper_primary_width() {
	$setting = phnewspaper_sidebar_setting();
		
	switch ($setting) {
		case 'no-sidebar':
			$class = 'col-md-12';
			break;
		case 'right-sidebar':
			$class = 'col-md-8';
			break;
		case 'right-sidebar-narrow':
			$class = 'col-md-9';
			break;
		case 'no-sidebar-narrow-primary':
			$class = 'col-md-8 offset-md-2 offset-sm-0 offset-lg-2';
			break;	
		default:
			$class = 'col-md-8 offset-md-2 offset-sm-0 offset-lg-2';
			break;					
	}
	echo esc_html($class); 
}
add_action('phnewspaper_primary_width_class','phnewspaper_primary_width');

function phnewspaper_secondary_width() {
	$setting = phnewspaper_sidebar_setting();
	
	switch ($setting) {
		case 'no-sidebar':
			$class = 'd-none';
			break;
		case 'no-sidebar-narrow-primary':
			$class = 'd-none';
			break;	
		case 'right-sidebar':
			$class = 'col-md-4';
			break;
		case 'right-sidebar-narrow':
			$class = 'col-md-3';
			break;
		default:
			$class = 'd-none';
			break;					
	}
	echo esc_html($class); 
}
add_action('phnewspaper_secondary_width_class','phnewspaper_secondary_width');


/**
 * LessCSS PHP Color Darken/Lighten
 */
function phnewspaper_darken_color($color_code,$percentage_adjuster = 0) {
	$percentage_adjuster = round($percentage_adjuster/100,2);
	if(preg_match("/#/",$color_code)) {
		$hex = str_replace("#","",$color_code);
		$r = (strlen($hex) == 3)? hexdec(substr($hex,0,1).substr($hex,0,1)):hexdec(substr($hex,0,2));
		$g = (strlen($hex) == 3)? hexdec(substr($hex,1,1).substr($hex,1,1)):hexdec(substr($hex,2,2));
		$b = (strlen($hex) == 3)? hexdec(substr($hex,2,1).substr($hex,2,1)):hexdec(substr($hex,4,2));
		$r = round($r - ($r*$percentage_adjuster));
		$g = round($g - ($g*$percentage_adjuster));
		$b = round($b - ($b*$percentage_adjuster));
 
		return "#".str_pad(dechex( max(0,min(255,$r)) ),2,"0",STR_PAD_LEFT)
			.str_pad(dechex( max(0,min(255,$g)) ),2,"0",STR_PAD_LEFT)
			.str_pad(dechex( max(0,min(255,$b)) ),2,"0",STR_PAD_LEFT);
	}
}

/**
 * Implement the Custom Colors feature.
 */
function phnewspaper_colors_override(){ ?>
 <style>
 	:root {
		 --phnewspaper-primary: <?php echo esc_html(get_theme_mod('phnewspaper-primary-color','#1b8415')); ?>;
		 --phnewspaper-primary-text: <?php echo esc_html(get_theme_mod('phnewspaper-primary-text-color','#f9ffe7')); ?>;
		 --phnewspaper-background-main: <?php echo esc_html(get_theme_mod('background_color','#ffffff')); ?>;
		 --phnewspaper-background-plain: <?php echo esc_html(get_theme_mod('phnewspaper-bg-plain-color','#fff')); ?>;

		 --phnewspaper-background-darker: <?php echo esc_html(get_theme_mod('phnewspaper-background-darker-color','#eeeeee')); ?>;
		 
		 --phnewspaper-secondary: <?php echo esc_html(get_theme_mod('phnewspaper-secondary-color','#747474')); ?>;
		 --phnewspaper-secondary-text: <?php echo esc_html(get_theme_mod('phnewspaper-secondary-text-color','#FFFFFF')); ?>;
		 --phnewspaper-secondary-dark: <?php echo esc_html(get_theme_mod('phnewspaper-secondary-dark-color','#076402')); ?>;
		 
		 --phnewspaper-text-dark: <?php echo esc_html(get_theme_mod('phnewspaper-text-dark-color','#111')); ?>;
		 --phnewspaper-text: <?php echo esc_html(get_theme_mod('phnewspaper-text-color','#555')); ?>;
		 --phnewspaper-text-light: <?php echo esc_html(get_theme_mod('phnewspaper-text-light-color','#777')); ?>;
		 --phnewspaper-menu-text: <?php echo esc_html(get_theme_mod('phnewspaper-menu-text-color','#232323')); ?>;
		 
		 --phnewspaper-header-background: <?php echo esc_html(get_theme_mod('phnewspaper-header-bg-color','#fff')); ?>;
		 --phnewspaper-header-text: <?php echo esc_html(get_theme_mod('phnewspaper-header-content-color','#FFFFFF')); ?>;
		 --phnewspaper-header-lighter: <?php echo esc_html(get_theme_mod('phnewspaper-header-bg-lighter-color','#222222')); ?>;
		 --phnewspaper-top-bar-text: <?php echo esc_html(get_theme_mod('phnewspaper-top-bar-text-color','#FFFDEC')); ?>;
		 --phnewspaper-top-bar-background: <?php echo esc_html(get_theme_mod('phnewspaper-top-bar-bg-color','#3a3a3a')); ?>;
		 
		 --phnewspaper-mobile-header-background: <?php echo esc_html(get_theme_mod('phnewspaper-header-mobile-bg-color','#000000')); ?>;
		 --phnewspaper-mobile-header-text: <?php echo esc_html(get_theme_mod('phnewspaper-header-mobile-text-color','#222222')); ?>;
	 }
	 
 </style>
<?php 
}
add_action( 'wp_head', 'phnewspaper_colors_override' );

/**
 * Implement Some Additional CSS based on theme mods.
 */
function phnewspaper_custom_css() {
	
	if (get_theme_mod('phnewspaper-enable-top-bar')) {
		?><style>
			#masthead.style2 #top-bar, #masthead.style3 #top-bar {
				background: <?php echo esc_attr(get_theme_mod('phnewspaper-top-bar-bg-color','#000000')); ?>;
			}
		</style><?php
	}
}
add_action( 'wp_head', 'phnewspaper_custom_css' );

/**
 * Implement Logo Max Height Limiter
 */
function phnewspaper_logo_max_height(){ ?>
 <style>
	 #masthead #site-branding .custom-logo {
		 max-height: <?php echo esc_attr(get_theme_mod('phnewspaper-logo-max-height', 90))."px"; ?> !important;
	 }
 </style>
<?php 
}
add_action( 'wp_head', 'phnewspaper_logo_max_height' );


/*
* Get Blog Posts Layout for Archive, Home & Tax Pages
*
*/ 
function phnewspaper_blog_layout_setting() {
	if (is_search())	
		$setting = get_theme_mod('phnewspaper-search-results-layout', 'style1');
	if (is_archive())
		$setting = get_theme_mod('phnewspaper-archives-layout', 'style3');
	if (is_home())
		$setting = get_theme_mod('phnewspaper-home-layout', 'style2');	
	
	return $setting;
}

function phnewspaper_blog_layout_display() {
	$layout = phnewspaper_blog_layout_setting();
	
	get_template_part( 'template-parts/blog-style/content', $layout );
}
add_action('phnewspaper_blog_layout','phnewspaper_blog_layout_display');

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

/**
 * Implement the Featured Modules
 */
require get_template_directory() . '/inc/display-featured-modules.php';

/**
 * Implement the Multiple Masthead Styles
 */
require get_template_directory() . '/inc/display-masthead.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';

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

/**
 * Customizer additions.
 */
require_once(get_template_directory() . '/tgmpa/tgmpa-configuration.php');

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


	
// Breadcrumbs
function phnewspaper_get_breadcrumbs() {
    echo '<a href="' . esc_url(home_url()) . '" rel="nofollow">' . esc_html__('Home', 'ph-news-paper') . '</a>';
    ?>
    <img id="greater-than" src="<?php echo esc_url(get_template_directory_uri() . '/template-parts/single-post/images/greater-than.png'); ?>" />

    <?php if (is_category() || is_single()) {
        echo "<span class='space'></span>";
        echo '<span>' . esc_html__('Category:', 'ph-news-paper') . '</span>';
        the_category(' &bull;');
        if (is_single()) { ?>
            <img id="greater-than" src="<?php echo esc_url(get_template_directory_uri() . '/template-parts/single-post/images/greater-than.png'); ?>" />
            <span><?php the_title(); ?></span>
        <?php }
    } elseif (is_page()) {
        echo "<span class='space'></span>";
        echo '<span>' . esc_html__('Page:', 'ph-news-paper') . '</span>';
        echo '<span>' . esc_html(get_the_title()) . '</span>';
    } elseif (is_search()) {
        echo "; " . esc_html__('Search Results for...', 'ph-news-paper') . " ";
        echo '<em>' . esc_html(get_search_query()) . '</em>';
    }
}

	function phnewspaper_sticky_sidebar_styles() {
		// Retrieve the value of the 'proto-sticky-sidebar-set' setting from the Customizer
		$sticky_sidebar_enabled = get_theme_mod('phnewspaper-sticky-sidebar-set');

		// Check if the sticky sidebar setting is enabled
		if ($sticky_sidebar_enabled) {
			?>
			<style>
				/* Apply sticky positioning to the sidebar when enabled */
				#secondary {
					height: fit-content;
					position: sticky;
					top: 0;
				}
			</style>
			<?php
		}
	}

	// Hook the function into the wp_head action to output styles in the head section
	add_action('wp_head', 'phnewspaper_sticky_sidebar_styles');


function ocdi_register_plugins( $plugins ) {
	$theme_plugins = [
	  [ // A WordPress.org plugin repository example.
		'name'     => 'One Click Demo Import', // Name of the plugin.
		'slug'     => 'one-click-demo-import', // Plugin slug - the same as on WordPress.org plugin repository.
		'required' => false,                     // If the plugin is required or not.
	  ],

	];
   
	return array_merge( $plugins, $theme_plugins );
  }
  add_filter( 'ocdi/register_plugins', 'ocdi_register_plugins' );



  function ocdi_import_files() {
	return [
	  [
		'import_file_name'           => 'General News(Free)',
		'categories'                 => [ 'General News' ],
		'import_file_url'            => 'https://theme-demos.pixahive.com/wp-content/themes/ph-news-paper/demo/newspaper.WordPress.2023-12-19.xml',
		'import_customizer_file_url' => 'https://theme-demos.pixahive.com/wp-content/themes/ph-news-paper/customizer-files/ph-news-paper-export.dat',
	
		'import_preview_image_url'   => 'https://pixahive.com/themes/wp-content/uploads/2023/12/paper.png',
		'preview_url'                => 'https://theme-demos.pixahive.com/ph-news-paper/',
	  ],

	  [
		'import_file_name'           => 'Travel(Free)',
		'categories'                 => [ 'Travel', ],
		'import_file_url'            => 'https://theme-demos.pixahive.com/wp-content/themes/ph-news-paper/demo/newspaper-travel19.xml',
		'import_customizer_file_url' => 'https://theme-demos.pixahive.com/wp-content/themes/ph-news-paper/customizer-files/ph-news-paper-travel.dat',
		
		'import_preview_image_url'   => 'https://pixahive.com/themes/wp-content/uploads/2023/12/tr.png',
		'preview_url'                => 'https://theme-demos.pixahive.com/ph-news-paper-travel/',
	  ],

	  [
		'import_file_name'           => 'Technology(Free)',
		'categories'                 => [ 'Tech'],
		'import_file_url'            => 'https://theme-demos.pixahive.com/wp-content/themes/ph-news-paper/demo/technews.WordPress.2023-12-19.xml',
		'import_customizer_file_url' => 'https://theme-demos.pixahive.com/wp-content/themes/ph-news-paper/customizer-files/ph-news-paper-tech.dat',
		
		'import_preview_image_url'   => 'https://pixahive.com/themes/wp-content/uploads/2023/12/techsdsa.png',
		'preview_url'                => 'https://theme-demos.pixahive.com/ph-news-paper-technology/',
	  ],

	  [
		'import_file_name'           => 'Fitness News(Free)',
		'categories'                 => [ 'Fitness' ],
		'import_file_url'            => 'https://theme-demos.pixahive.com/wp-content/themes/ph-news-paper/demo/news-paper-fitness.xml',
		'import_customizer_file_url' => 'https://theme-demos.pixahive.com/wp-content/themes/ph-news-paper/customizer-files/ph-news-paper-fitness.dat',
		
		'import_preview_image_url'   => 'https://pixahive.com/themes/wp-content/uploads/2023/12/ft.png',
		'preview_url'                => 'https://theme-demos.pixahive.com/ph-news-paper-fitness/',
	  ],

	  [
		'import_file_name'           => 'Skincare and Makeup(Free)',
		'categories'                 => [ 'Beauty and Skincare' ],
		'import_file_url'            => 'https://theme-demos.pixahive.com/wp-content/themes/ph-news-paper/demo/skincare-and-makeup.xml',
		'import_customizer_file_url' => 'https://theme-demos.pixahive.com/wp-content/themes/ph-news-paper/customizer-files/ph-news-paper-skincare-and-makeup.dat',
		
		'import_preview_image_url'   => 'https://theme-demos.pixahive.com/ph-news-paper-skincare-and-makeup/wp-content/uploads/sites/22/2023/12/blossom.png',
		'preview_url'                => 'https://theme-demos.pixahive.com/ph-news-paper-skincare-and-makeup/',
	  ],

	[
		'import_file_name'           => 'Sports Blog(Free)',
		'categories'                 => [ 'Sports'],
		'import_file_url'            => 'https://theme-demos.pixahive.com/wp-content/themes/ph-news-paper/demo/ph-news-paper-sports.xml',
		'import_customizer_file_url' => 'https://theme-demos.pixahive.com/wp-content/themes/ph-news-paper/customizer-files/ph-news-paper-sports.dat',
		
		'import_preview_image_url'   => 'https://pixahive.com/themes/wp-content/uploads/2023/12/sp.png',
		'preview_url'                => 'https://theme-demos.pixahive.com/ph-news-paper-sports/',
	],

	[
		'import_file_name'           => 'World News(Pro)',
		'categories'                 => [ 'News'],		
		'import_preview_image_url'   => 'https://pixahive.com/themes/wp-content/uploads/2024/01/World-news.png',
		'preview_url'                => 'https://theme-demos.pixahive.com/ph-news-paper-pro/',
	],
	[
		'import_file_name'           => 'Ai Blog(Pro)',
		'categories'                 => [ 'Tech'],		
		'import_preview_image_url'   => 'https://pixahive.com/themes/wp-content/uploads/2024/01/ai.png',
		'preview_url'                => 'https://theme-demos.pixahive.com/ph-news-paper-pro-ai-blog/',
	],
	[
		'import_file_name'           => 'Food Recipe Blog(Pro)',
		'categories'                 => [ 'Food'],		
		'import_preview_image_url'   => 'https://pixahive.com/themes/wp-content/uploads/2024/01/recipe.png',
		'preview_url'                => 'https://theme-demos.pixahive.com/ph-news-paper-pro-recipe-blog/',
	],
	[
		'import_file_name'           => 'Photographers Blog(Pro)',
		'categories'                 => [ 'Photography'],		
		'import_preview_image_url'   => 'https://pixahive.com/themes/wp-content/uploads/2024/01/photography-.png',
		'preview_url'                => 'https://theme-demos.pixahive.com/ph-news-paper-pro-photography/',
	],
];
  }
  add_filter( 'ocdi/import_files', 'ocdi_import_files' );

  function enqueue_custom_admin_scripts($hook) {
    if ($hook !== 'appearance_page_one-click-demo-import') {
        return;
    }
    wp_enqueue_script('theme-js', get_template_directory_uri() . '/js/theme.js', array('jquery'), '1.0', true);
}
add_action('admin_enqueue_scripts', 'enqueue_custom_admin_scripts');
