?php /** * rewview functions and definitions * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package rewview */ if ( ! defined( '_S_VERSION' ) ) { // Replace the version number of the theme on each release. define( '_S_VERSION', '1.0.0' ); } /** * 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 rewview_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on rewview, use a find and replace * to change 'rewview' to the name of your theme in all the template files. */ load_theme_textdomain( 'rewview', 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 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( 'top_menu' => esc_html__( 'Top Menu', 'rewview' ), 'bottom1_menu' => esc_html__( 'Bottom1', 'rewview' ), 'bottom2_menu' => esc_html__( 'Bottom2', 'rewview' ), 'bottom3_menu' => esc_html__( 'Bottom3', 'rewview' ), 'bottom4_menu' => esc_html__( 'Bottom4', 'rewview' ), ) ); /* * 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. add_theme_support( 'custom-background', apply_filters( 'rewview_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_action( 'after_setup_theme', 'rewview_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 rewview_content_width() { $GLOBALS['content_width'] = apply_filters( 'rewview_content_width', 640 ); } add_action( 'after_setup_theme', 'rewview_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function rewview_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'rewview' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'rewview' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'rewview_widgets_init' ); /** * Enqueue scripts and styles. */ function rewview_enqueue_styles_scripts() { // Регистрация и подключение стилей wp_enqueue_style('swiper-bundle', get_template_directory_uri() . '/css/swiper-bundle.min.css', array(), '1.0', 'all'); wp_enqueue_style('main-style', get_template_directory_uri() . '/css/style.css', array(), '1.0', 'all'); // Регистрация и подключение скриптов wp_enqueue_script('swiper-bundle', get_template_directory_uri() . '/js/swiper-bundle.min.js', array(), '1.0', true); wp_enqueue_script('main-scripts', get_template_directory_uri() . '/js/scripts.js', array(), '1.0', true); } add_action('wp_enqueue_scripts', 'rewview_enqueue_styles_scripts'); function rewview_add_favicons() { echo ' <link rel="apple-touch-icon" sizes="180x180" href="' . get_template_directory_uri() . '/apple-touch-icon.png"> <link rel="icon" type="image/png" sizes="32x32" href="' . get_template_directory_uri() . '/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="' . get_template_directory_uri() . '/favicon-16x16.png"> '; } add_action('wp_head', 'rewview_add_favicons'); // register post type review require get_template_directory() . '/register_post_type.php'; require get_template_directory() . '/register_taxonomy.php'; require get_template_directory() . '/admin_pages.php'; if( function_exists('acf_add_options_page') ) { acf_add_options_page(array( 'page_title' => 'review top', 'menu_title' => 'Top reviews', 'menu_slug' => 'top-review-settings', 'capability' => 'edit_posts', 'redirect' => false )); } function get_top_reviews($number = 3) { $top_reviews = get_field('top3_reviews', 'option'); if ($top_reviews) { return array_slice($top_reviews, 0, $number); } else { return false; } } // shortcodes require get_template_directory() . '/shortcode/space.php'; require get_template_directory() . '/shortcode/toplist.php'; require get_template_directory() . '/shortcode/advantages.php'; require get_template_directory() . '/shortcode/cta.php'; require get_template_directory() . '/shortcode/content_image_left.php'; require get_template_directory() . '/shortcode/features.php'; require get_template_directory() . '/shortcode/games_list.php'; require get_template_directory() . '/shortcode/facts_list.php'; require get_template_directory() . '/shortcode/blacklist.php'; require get_template_directory() . '/shortcode/numbered_list.php'; require get_template_directory() . '/shortcode/howto.php'; require get_template_directory() . '/shortcode/tables.php'; require get_template_directory() . '/shortcode/faq.php'; require get_template_directory() . '/shortcode/similar_articles.php'; require get_template_directory() . '/shortcode/gradient_cards_row4.php'; require get_template_directory() . '/shortcode/top3copy.php'; require get_template_directory() . '/shortcode/links.php'; require get_template_directory() . '/shortcode/games_cta.php'; require get_template_directory() . '/shortcode/how_to_tabs.php'; require get_template_directory() . '/shortcode/brand_preview.php'; require get_template_directory() . '/shortcode/page_date.php'; require get_template_directory() . '/shortcode/checklist.php'; require get_template_directory() . '/shortcode/banner.php'; require get_template_directory() . '/shortcode/readmore.php'; require get_template_directory() . '/shortcode/casinopromo.php'; require get_template_directory() . '/shortcode/accent.php'; require get_template_directory() . '/shortcode/mailform.php'; require get_template_directory() . '/shortcode/bonus_requirement.php'; require get_template_directory() . '/shortcode/expand.php'; require get_template_directory() . '/shortcode/bonusinfo.php'; require get_template_directory() . '/shortcode/toc.php'; require get_template_directory() . '/shortcode/casinotabs.php'; require get_template_directory() . '/shortcode/casinoverdict.php'; require get_template_directory() . '/shortcode/h2_rating.php'; require get_template_directory() . '/shortcode/devices_v1.php'; require get_template_directory() . '/shortcode/devices_v2.php'; require get_template_directory() . '/shortcode/comment_editor.php'; require get_template_directory() . '/shortcode/comment_author.php'; require get_template_directory() . '/shortcode/comment_form_add.php'; require get_template_directory() . '/shortcode/accent_section.php'; require get_template_directory() . '/shortcode/stats.php'; require get_template_directory() . '/shortcode/approach.php'; require get_template_directory() . '/shortcode/trust.php'; require get_template_directory() . '/shortcode/authors.php'; require get_template_directory() . '/shortcode/history.php'; require get_template_directory() . '/shortcode/socials.php'; require get_template_directory() . '/shortcode/postmain.php'; require get_template_directory() . '/shortcode/posts.php'; require get_template_directory() . '/shortcode/postsmost.php'; require get_template_directory() . '/shortcode/postinfo.php'; require get_template_directory() . '/shortcode/postinfo_share.php'; require get_template_directory() . '/shortcode/authors_grid.php'; require get_template_directory() . '/shortcode/writerstop.php'; require get_template_directory() . '/shortcode/writerhero.php'; require get_template_directory() . '/shortcode/writerbadges.php'; require get_template_directory() . '/shortcode/morecasinos.php'; require get_template_directory() . '/shortcode/other_reviews.php'; require get_template_directory() . '/shortcode/casino_cards.php'; class Custom_Walker_Nav_Menu extends Walker_Nav_Menu { function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<ul class=\"sub-menu\">\n"; } function start_el(&$output, $item, $depth=0, $args=array(), $id=0) { $classes = empty($item->classes) ? array() : (array) $item->classes; // Add custom class to the menu item if ($depth == 0 && in_array('menu-item-has-children', $classes)) { $classes[] = 'menu-item menu-item-has-children'; } else { $classes[] = 'menu-item'; } $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item)); $class_names = ' class="' . esc_attr($class_names) . '"'; $output .= '<li id="menu-item-'. $item->ID . '"' . $class_names .'>'; $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; $attributes .= ' class="menu-link ' . ( $depth > 0 ? 'sub-menu-link' : 'main-menu-link' ) . '"'; $item_output = $args->before; $item_output .= '<a'. $attributes .'>'; $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; $item_output .= '</a>'; $item_output .= $args->after; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); } } if( function_exists('acf_add_options_page') ) { acf_add_options_page(array( 'page_title' => 'Theme Settings', 'menu_title' => 'Theme Settings', 'menu_slug' => 'theme-settings', 'capability' => 'edit_posts', 'redirect' => false )); } /** * Affiliate URL for a brand (review). * * Referral link is the field editors fill. Older Button URL / top3_link values * are used only when the referral link is empty. "#" is treated as empty. * * @param int $post_id Review ID. * @return string */ function rewview_get_referral_url( $post_id ) { $post_id = (int) $post_id; if ( $post_id < 1 || ! function_exists( 'get_field' ) ) { return ''; } $candidates = array( 'referral_link', 'top3_link', 'casino_preview_button_url' ); foreach ( $candidates as $name ) { $url = trim( (string) get_field( $name, $post_id ) ); if ( '' === $url || '#' === $url ) { continue; } return $url; } return ''; } /** * Referral link field on each brand (review) edit screen. */ function rewview_register_referral_link_field() { if ( ! function_exists( 'acf_add_local_field_group' ) ) { return; } acf_add_local_field_group(array( 'key' => 'group_rewview_referral_link', 'title' => 'Referral link', 'fields' => array( array( 'key' => 'field_rewview_referral_link', 'label' => 'Referral link', 'name' => 'referral_link', 'type' => 'text', 'instructions' => 'Path or full URL, for example /casino-argent-reel-maroc/ or https://example.com/. Play Now buttons on the top cards, the toplist, and this brand page use this link.', 'required' => 0, 'placeholder' => '/casino-argent-reel-maroc/', ), ), 'location' => array( array( array( 'param' => 'post_type', 'operator' => '==', 'value' => 'review', ), ), ), 'position' => 'acf_after_title', 'style' => 'default', 'label_placement' => 'top', 'menu_order' => 0, 'active' => true, )); } add_action( 'acf/init', 'rewview_register_referral_link_field' ); function rewview_ui( $name, $default ) { if ( function_exists( 'get_field' ) ) { $value = trim( (string) get_field( $name, 'option' ) ); if ( '' !== $value ) { return $value; } } return $default; } function rewview_translation_field_definitions() { $interface = array( 'ui_play_now' => 'Play Now', 'ui_read_review' => 'Read Review', 'ui_read_more' => 'Read more', 'ui_show_more' => 'Show more', 'ui_show_less' => 'Less', 'ui_go_to_casino' => 'Go to Casino', 'ui_toc_title' => 'Table of content', 'ui_promo_code' => 'Promo code', 'ui_games' => 'Games', 'ui_banking' => 'Banking methods', 'ui_search' => 'Search', 'ui_select_country' => 'Select Country', ); $tables = array( 'ui_table_bonus' => 'Bonus', 'ui_table_rating' => 'Rating', 'ui_table_payments' => 'Payment methods', 'ui_table_wagering' => 'Wagering', 'ui_table_min_deposit' => 'Min deposit', ); $fields = array( array( 'key' => 'tab_interface_translations', 'label' => 'Interface Translations', 'name' => 'interface_translations_tab', 'type' => 'tab', 'placement' => 'top', ), ); foreach ( $interface as $name => $label ) { $fields[] = array( 'key' => 'field_' . $name, 'label' => $label, 'name' => $name, 'type' => 'text', 'default_value' => $label, ); } $fields[] = array( 'key' => 'tab_table_translations', 'label' => 'Table Translations', 'name' => 'table_translations_tab', 'type' => 'tab', 'placement' => 'top', ); foreach ( $tables as $name => $label ) { $fields[] = array( 'key' => 'field_' . $name, 'label' => $label, 'name' => $name, 'type' => 'text', 'default_value' => $label, ); } return $fields; } function rewview_register_translation_fields() { if ( ! function_exists( 'acf_add_local_field' ) ) { return; } foreach ( rewview_translation_field_definitions() as $field ) { // Not the Theme Settings group key. ACF loads either local fields or // database fields for a group, never both, so this parent must stay separate. $field['parent'] = 'rewview_translation_fields'; acf_add_local_field( $field ); } } add_action( 'acf/init', 'rewview_register_translation_fields', 20 ); function rewview_add_translation_fields( $fields, $parent ) { if ( ! is_array( $parent ) || empty( $parent['key'] ) || 'group_theme_settings' !== $parent['key'] ) { return $fields; } foreach ( $fields as $field ) { if ( isset( $field['key'] ) && 'tab_interface_translations' === $field['key'] ) { return $fields; } } return array_merge( $fields, rewview_translation_field_definitions() ); } add_filter( 'acf/load_fields', 'rewview_add_translation_fields', 20, 2 ); <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//casinoenlignema.com/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap> <loc>https://casinoenlignema.com/page-sitemap.xml</loc> <lastmod>2026-10-09T07:14:29+00:00</lastmod> </sitemap> </sitemapindex> <!-- XML Sitemap generated by Yoast SEO -->