// Enqueue the JavaScript file for Brazilian Portuguese Tarot Reading
function tarot_reading_portugeseb_enqueue_scripts() {
if (is_front_page() && strpos($_SERVER['REQUEST_URI'], '/pt-br/') !== false) { // Check if it's the homepage and has /pt-br
wp_enqueue_script('tarot-reading-portugeseb-js', get_template_directory_uri() . '/assets/js/tarot-reading-portugeseb.js', array('jquery'), '1.0.1', true);
wp_localize_script('tarot-reading-portugeseb-js', 'ajax_object_portugeseb', array('ajax_url' => admin_url('admin-ajax.php', 'https')));
}
}
add_action('wp_enqueue_scripts', 'tarot_reading_portugeseb_enqueue_scripts');
// Function to classify cards as Major or Minor Arcana in Brazilian Portuguese
function classify_tarot_cards_portugeseb($cards) {
// List of all Major Arcana cards in Brazilian Portuguese
$major_arcana = array(
"O Louco", "O Mago", "A Sacerdotisa", "A Imperatriz",
"O Imperador", "O Hierofante", "Os Enamorados", "O Carro",
"A Força", "O Eremita", "A Roda da Fortuna", "A Justiça",
"O Enforcado", "A Morte", "A Temperança", "O Diabo",
"A Torre", "A Estrela", "A Lua", "O Sol",
"O Julgamento", "O Mundo"
);
$classified_cards = array();
foreach ($cards as $card) {
if (in_array($card, $major_arcana)) {
// Use Brazilian Portuguese terminology: "Arcanos Maiores"
$classified_cards[] = "$card - Arcanos Maiores";
} else {
// Use Brazilian Portuguese terminology: "Arcanos Menores"
$classified_cards[] = "$card - Arcanos Menores";
}
}
return $classified_cards;
}
// AJAX handler for fetching Brazilian Portuguese tarot reading
function get_tarot_reading_portugeseb() {
if (empty($_POST['card_names'])) {
wp_send_json_error('Parâmetros ausentes');
exit;
}
$user_question = sanitize_text_field($_POST['user_question']);
$card_names = json_decode(stripslashes($_POST['card_names']), true);
// Classify cards as Major or Minor Arcana in Brazilian Portuguese
$classified_cards = classify_tarot_cards_portugeseb($card_names);
// Prepare the prompt
$prompt = "As cartas de tarô selecionadas são: " . implode(", ", $classified_cards) . ".";
if (!empty($user_question)) {
$prompt .= " O usuário perguntou: " . $user_question . ". Faça uma leitura de tarô focada na resposta para essa pergunta.";
} else {
$prompt .= " Faça uma leitura de tarô interpretando as cartas selecionadas.";
}
// Make request to ChatGPT API
$response = wp_remote_post('https://api.openai.com/v1/chat/completions', array(
'method' => 'POST',
'timeout' => 60,
'headers' => array(
'Authorization' => 'Bearer ' . CHATGPT_API_KEY,
'Content-Type' => 'application/json',
),
'body' => json_encode(array(
'model' => 'gpt-4o-mini',
'messages' => array(
array('role' => 'system', 'content' => 'Você é um leitor de tarô. Forneça uma leitura reflexiva e concisa do tarô, focando na interação entre as combinações de cartas. Se cartas dos Arcanos Maiores forem escolhidas, inicie a leitura com 1-2 frases destacando a quantidade de cartas dos Arcanos Maiores e Menores, sua raridade e significado. Use uma linguagem encorajadora e inspiradora, evite negrito e utilize emojis. A estrutura da resposta deve ser dividida em vários parágrafos, cada um com no máximo três frases. O último parágrafo deve resumir os pontos principais e oferecer sugestões práticas. Sempre responda em português brasileiro.'),
array('role' => 'user', 'content' => $prompt)
),
'temperature' => 0.7,
'max_tokens' => 700,
)),
));
if (is_wp_error($response)) {
wp_send_json_error('Erro na solicitação: ' . $response->get_error_message());
exit;
}
$body = json_decode(wp_remote_retrieve_body($response), true);
if (isset($body['choices'][0]['message']['content'])) {
$reading = trim($body['choices'][0]['message']['content']);
wp_send_json_success(array('message' => $reading));
} else {
$error_message = isset($body['error']['message']) ? $body['error']['message'] : 'Erro desconhecido';
wp_send_json_error('Erro na resposta da API: ' . $error_message);
}
}
add_action('wp_ajax_get_tarot_reading_portugeseb', 'get_tarot_reading_portugeseb');
add_action('wp_ajax_nopriv_get_tarot_reading_portugeseb', 'get_tarot_reading_portugeseb');
Enjoy a mix of free and exclusive readings crafted for our members – with even more exciting options coming soon
Three Tarot Cards
Quick & Free
Get insights to any question with a three-card draw. Quick, simple, and free.
Start Now
Psychic
Experience a Psychic Reading
Tap into hidden energies and deeper truths to help you navigate life’s mysteries.
Start Now
True Love Tarot
Detailed, Yet Free Reading
Uncover hidden truths in your significant connection.
Try It Now
Yes & No Tarot
Coming Soon
Ask a question and get a Yes or No answer instantly. Perfect for quick decisions.
Coming Soon
Dream Interpreter
Coming Soon
Unlock your dreams. Decode symbols to uncover hidden guidance.
Coming Soon
One Card
Coming Soon
Get quick guidance with a single card. Receive concise insights instantly.
Coming Soon
Fairy
Coming Soon
Unlock the magic of fairy cards with a unique message for fresh perspective.
Coming Soon
Share Your Ideas
Tell Us What You Need
Tell us what type of reading you’d like to see. Your feedback helps us craft the perfect experience for you.
Tell Us Here
t
Explore Unique Reading Styles
Choose a reading style that resonates with you, guided by a variety of tarologists. Currently offering personalized Three Card Readings – more coming soon!
Our standard readings are delivered by our expert tarologist, Ollie. Get to know Ollie and explore the unique styles of our other Al tarot readers: Christine, Julien, and Sam.
Ollie
Ollie is your go-to AI tarot guide, combining ethical principles with intuitive insights. Always ready to answer your questions, Ollie helps you find clarity and navigate life’s challenges.
Christine integrates her knowledge of psychology, using tarot cards as a tool for intuitive guidance. She believes that tarot helps clients connect with their inner voice and gain clarity.
Julien delves into the mystical aspects of tarot and spirituality with passion. His readings focus on uncovering deeper meanings and connecting with higher energies.
Sam brings a no-nonsense, mix of kindness with tough love approach. He is a fun, quirky and a little sassy interpreter, cutting through ambiguity to deliver direct answers to your questions.
Get Exclusive Free Features – Join Our Mailing List Today
Unlock Tarot for Free – Limited Time Offer
Subscribe now to our mailing list and unlock free access to exclusive Tarot features as a valued supporter as we roll them out. Be among the first to enjoy unique readings, expert insights, and premium content, all at no cost.
Support us and shape the future of Tarot while gaining access to amazing perks.
Subscribe Now – It’s Free.