<? 
/**
 * Plugin Name: Atlas Customizations
 * Description: Do not remove please! This plugin includes site-specific functions. If you have it installed, inspect it's code before deactivation.
 * Author: Portnov Internet Agency
 * Author URL: https://portnov.agency/
 * Version: 1.0.0
 */

define( 'PLUGIN_DIR', dirname( __FILE__ ) );

require_once PLUGIN_DIR . '/assets/index.php';
require_once PLUGIN_DIR . '/shortcodes.php';

add_filter( 'get_the_archive_title', function ( $title ) {
    if( is_home() ) {
        $title = __('Actualités','atlas');
    }
    return $title;
});

/**
 * Do not show sticky
 */
function remove_sticky_from_main_loop( $query ) {
	if( is_home() && $query->is_main_query() && ! is_admin() ) {
		$query->set( 'ignore_sticky_posts', true );
		$query->set( 'post__not_in', get_option('sticky_posts') );
	}
}
add_action( 'pre_get_posts', 'remove_sticky_from_main_loop' );

/**
 * AJAX load more, following this tutorial - https://rudrastyh.com/wordpress/load-more-posts-ajax.html 
 */
function atlas_loadmore_ajax_handler(){
 
	// prepare our arguments for the query
	$args = json_decode( stripslashes( $_POST['query'] ), true );
	$args['paged'] = $_POST['page'] + 1; // we need next page to be loaded
	$args['post_status'] = 'publish';
 
	// it is always better to use WP_Query but not here
	query_posts( $args );
 
	if( have_posts() ) :
 
		// run the loop
		while( have_posts() ): the_post();

      ?>
			<a class="item atlas-item"  href="<?the_permalink()?>">
				<div class="cat">
									</div>
				<div class="date"></div>
				<h2><?the_title();?></h2>
				<div class="text">
									</div>
				<span class="more"><span>+</span></span>
			</a>
      <?
 
		endwhile;
 
	endif;
	die; // here we exit the script and even no wp_reset_query() required!
}
 
add_action('wp_ajax_loadmore', 'atlas_loadmore_ajax_handler'); // wp_ajax_{action}
add_action('wp_ajax_nopriv_loadmore', 'atlas_loadmore_ajax_handler'); // wp_ajax_nopriv_{action}<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//atlascapital.ma/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>https://atlascapital.ma/post-sitemap.xml</loc>
		<lastmod>2026-09-28T20:27:58+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://atlascapital.ma/page-sitemap.xml</loc>
		<lastmod>2026-10-21T14:57:13+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://atlascapital.ma/awsm_job_openings-sitemap.xml</loc>
		<lastmod>2024-02-01T04:06:18+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://atlascapital.ma/category-sitemap.xml</loc>
		<lastmod>2026-09-28T20:27:58+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://atlascapital.ma/fusion_tb_category-sitemap.xml</loc>
		<lastmod>2025-02-20T02:55:26+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://atlascapital.ma/job-category-sitemap.xml</loc>
		<lastmod>2023-09-05T01:28:03+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://atlascapital.ma/job-location-sitemap.xml</loc>
		<lastmod>2023-09-05T01:28:03+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://atlascapital.ma/element_category-sitemap.xml</loc>
		<lastmod>2023-08-29T02:34:23+00:00</lastmod>
	</sitemap>
</sitemapindex>
<!-- XML Sitemap generated by Yoast SEO -->