add_filter('the_content','nl7za_random_watermark_overlay',20); function nl7za_random_watermark_overlay($content){ if(is_singular('post') && in_the_loop() && is_main_query()){ return preg_replace_callback( '#]+>#i', function($matches){ // اختيارات مواضع عشوائية $positions = [ 'top:10px; left:10px;', 'top:10px; right:10px;', 'bottom:10px; left:10px;', 'bottom:10px; right:10px;', 'top:50%; left:50%; transform:translate(-50%,-50%);' ]; $style = $positions[array_rand($positions)]; // عنوان المقال $title = get_the_title(); // غلاف الصورة + الـspan للعلامة return '
' .$matches[0]. '' .esc_html($title). '
'; }, $content ); } return $content; }