<?php
/**
 * Polylang integration.
 *
 * @package ALFASMART
 */

if (! defined('ABSPATH')) {
    exit;
}

add_filter('pll_get_post_types', function ($post_types, $is_settings) {
    if ($is_settings) {
        return $post_types;
    }

    $post_types['companies'] = 'companies';
    $post_types['services']  = 'services';

    return $post_types;
}, 10, 2);

add_action('init', function () {
    if (! function_exists('pll_register_string')) {
        return;
    }

    foreach (array('Home', 'About Us', 'Companies', 'Services', 'Contact', 'English', 'Arabic') as $string) {
        pll_register_string('alfasmart_' . sanitize_key($string), $string, 'ALFASMART');
    }
});
