<?php
/**
 * Custom functions to be used within Elementor plugin.
 *
 * @package    NewsCurve
 * @since      NewsCurve 1.0.0
 */

if ( ! function_exists( 'newscurve_elementor_categories' ) ) :

	/**
	 * Return the values of all the categories of the posts present in the site.
	 *
	 * @return array of category ids and its respective names.
	 *
	 * @since NewsCurve 1.0.0
	 */
	function newscurve_elementor_categories() {
		$output     = array();
		$categories = get_categories();

		foreach ( $categories as $category ) {
			$output[ $category->term_id ] = $category->name;
		}

		return $output;
	}

endif;

if ( ! function_exists( 'newscurve_elementor_styles' ) ) :

	/**
	 * Loads styles on elementor editor.
	 *
	 * @since NewsCurve 1.0.0
	 */
	function newscurve_elementor_styles() {
		wp_enqueue_style( 'newscurve-econs', get_template_directory_uri() . '/inc/compatibility/elementor/assets/css/newscurve-econs.css', false, '1.0' );
	}

endif;

add_action( 'elementor/editor/after_enqueue_styles', 'newscurve_elementor_styles' );
