function get_booth_ids_from_svg($s_id) { $svgData = get_field(‘svg_floorplan_file’, $s_id); $dom = new DOMDocument(); $html = ‘ ‘; $result = ‘ The data included in this document is from www.openstreetmap.org. The data is made available under ODbL. ‘; $doc = new DOMDocument; $doc->loadXML($result);…Continue reading
add_action(‘acf/init’, ‘acf_init_google_api_key’); function acf_init_google_api_key() { acf_update_setting(‘google_api_key’, ‘AIzaSyAN_UuSnJqi4C4cinccmoHtK619hGptrbc’); }Continue reading
add_filter(‘acf/format_value/type=text’, ‘acf_do_shortcode’, 10, 3); add_filter(‘acf/format_value/type=textarea’, ‘acf_do_shortcode’, 10, 3); function acf_do_shortcode($value, $post_id, $field) { if (is_admin()) { return $value; } return apply_filters(‘the_content’, $value); }Continue reading
function render_user_gallery() { if (!is_user_logged_in()) { error_log(“[GALLERY] User not logged in.”); return ‘ You must be logged in to view your gallery. ‘; } // Retrieve user info and directories $current_user = wp_get_current_user(); $user_id = $current_user->ID; $upload_dir = wp_upload_dir(); $user_dir…Continue reading
function display_user_enrolled_courses() { if (!is_user_logged_in()) { return “الرجاء تسجيل الدخول لرؤية دوراتك”; } if (!function_exists(‘tutor’)) { return “النظام غير متاح حاليًا”; } $user_id = get_current_user_id(); $enrolled_courses = tutor_utils()->get_enrolled_courses_by_user($user_id); if (empty($enrolled_courses)) { return “لم تشترك في أي دورة بعد”; } $output…Continue reading
header(‘Content-Type: application/json’); function uploadImageToUploadsFolder() { if (isset($_FILES[‘image’]) && $_FILES[‘image’][‘error’] === UPLOAD_ERR_OK) { $image = $_FILES[‘image’]; $custom_tags = isset($_POST[‘tags’]) ? sanitize_text_field($_POST[‘tags’]) : ”; // Loguez le chemin temporaire pour vérifier où le fichier est initialement téléchargé error_log(‘Chemin temporaire du fichier :…Continue reading
function hide_html_editor_for_shop_manager() { $user = wp_get_current_user(); if (in_array(‘shop_manager’, (array) $user->roles)) { echo ‘ ‘; } } add_action(‘admin_head’, ‘hide_html_editor_for_shop_manager’); function customize_shop_manager_role() { // Get the Shop Manager role object $role = get_role(‘shop_manager’); // Remove ‘publish’ capabilities for products $role->remove_cap(‘publish_products’); // Remove…Continue reading
function get_term_plural_name($term_id, $taxonomy = ‘category’) { $plural = get_term_meta($term_id, ‘plural_name’, true); return $plural ?: get_term($term_id, $taxonomy)>name; } add_filter(‘get_the_terms’, function ($terms, $post_id, $taxonomy) { if (is_archive() || is_home()) { // Only for list contexts foreach ($terms as $term) { $plural =…Continue reading
function add_plural_field_to_taxonomy($term) { $plural = get_term_meta($term->term_id, ‘plural_name’, true); ?> Category Plural NameContinue reading
function convert_to_webp($file) { $file_path = $file[‘file’]; $file_type = $file[‘type’]; // Only for JPEG, PNG, and GIF images if (in_array($file_type, [‘image/jpeg’, ‘image/png’, ‘image/gif’, ‘image/jpg’])) { $webp_path = preg_replace(‘/.(jpe?g|png|gif)$/i’, ‘.webp’, $file_path); // Check if the GD library is available if (!function_exists(‘gd_info’)) {…Continue reading