// 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');
Resources - Sunrise Reading | Articles, Guides, and Tarot Insights
Hoppa till innehåll
From beginner guides to in-depth card meanings, our curated articles offer valuable insights to enhance your Tarot practice. Discover, learn, and grow with us.
No Posts Found!
t
Discover Major and Minor Arcana
From the transformative life lessons of the Major Arcana to the relatable, everyday insights of the Minor Arcana suits—Cups, Wands, Swords, and Pentacles.
Major Arcana
The Major Arcana represents life's profound lessons and spiritual themes, with each card symbolizing pivotal experiences or stages of self-discovery.
CLICK FOR ALL MAJOR ARCANA MEANINGS
Minor Arcana - Cups
The Cups in the Minor Arcana represent emotions, relationships, and inner experiences, often reflecting matters of the heart and intuition.
CLICK FOR ALL CUPS CARDS MEANINGS
Minor Arcana - Wands
The Wands in the Minor Arcana represent creativity, ambition, and the drive for action, often reflecting inspiration and personal growth.
CLICK FOR ALL WANDS CARDS MEANINGS
Minor Arcana - Swords
The Swords in the Minor Arcana symbolize the realm of thoughts, conflicts, and decisions, often focusing on challenges and mental clarity.
CLICK FOR ALL SWORDS CARDS MEANINGS
Minor Arcana - Pentacles
The Pentacles represent the material world, touching on themes of work, finances, and physical well-being.
CLICK FOR ALL PENTACLES CARDS MEANINGS
t
Ready to Start Your Journey?
Whether you're seeking answers or simply exploring, our Al Tarot Readings are here to guide you.