nueva



‘text’, ‘data’ => $datos));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’, ‘apikey: ‘ . $api_key));

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);

return $data[‘data’][‘image’];
}

// Genera el código QR dinámicamente
$qr_image_url = generarCodigoQR($current_user->user_login);

// Envía el código QR por correo electrónico
$to = $current_user->user_email;
$subject = ‘Tu código QR’;
$message = ‘Adjunto encontrarás tu código QR.’;
$headers = array(‘Content-Type: text/html; charset=UTF-8’);

// Adjunta el código QR al correo electrónico
$attachments = array($qr_image_url);

// Envía el correo electrónico
wp_mail($to, $subject, $message, $headers, $attachments);

// Resto del contenido de tu página
while (have_posts()) :
the_post();
get_template_part(‘template-parts/content’, ‘page’);
endwhile;

?>