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
if ( ! is_ssl() ) { wp_redirect( ‘https://’ . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’], 301 ); exit(); }Continue reading
add_filter( ‘wp_mail’, function ( $args ) { // Add the BCC email address here $bcc_address = ‘Bcc: [email protected]’; if ( ! empty( $args[ ‘headers’ ] ) ) { if ( ! is_array( $args[ ‘headers’ ] ) ) { $args[ ‘headers’…Continue reading
/** * Disable the password change notification email. * – Prevents admin notifications when users change their passwords. */ add_filter(‘wp_password_change_notification_email’, ‘__return_false’);Continue reading
/** * Add custom CSS styles for the WordPress login page. * – Styles include a custom registration button and login field adjustments. */ function add_custom_login_styles() { echo ‘ ‘; } add_action(‘login_head’, ‘add_custom_login_styles’); /** * Disable the language dropdown on…Continue reading