background ) ? esc_attr( $this->background ) : 'linear-gradient(90deg,rgb(0,0,0) 0%,rgb(0,0,0) 35%,rgb(0,0,0) 70%,rgb(0,0,0) 100%) '; $text_color = ! empty( $this->text_color ) ? esc_attr( $this->text_color ) : '#fff'; ?>
  • title ); ?> button_text ); ?>

  • __('Primary Menu', 'bluetone'), )); } add_action('after_setup_theme', 'bluetone_theme_setup'); // Função para criar uma página se ela não existir (exceto para 404) function bluetone_create_page_if_not_exists($title, $slug) { // Evita a criação da página 404 if ($slug === '404') { return null; // Retorna null para evitar a criação da página 404 } $page = get_page_by_path($slug); if (!$page) { $page_id = wp_insert_post(array( 'post_title' => $title, 'post_name' => $slug, 'post_status' => 'publish', 'post_type' => 'page', )); return $page_id; } else { return $page->ID; } } // Cria ou sobrescreve o menu padrão function bluetone_create_or_update_menus() { // Verifica se o menu 'Primary Menu' já existe $menu_exists = wp_get_nav_menu_object('Primary Menu'); // Deleta o menu existente if ($menu_exists) { wp_delete_nav_menu($menu_exists->term_id); } // Cria o menu 'Primary Menu' $menu_id = wp_create_nav_menu('Primary Menu'); // Cria páginas se elas não existirem e adiciona os itens principais ao menu $pages_to_create = array( array('Home', '/home', 'home'), array('Blog', '/blog', 'blog'), array('About', '/about', 'about'), array('Reviews', '/reviews', 'reviews'), array('FAQ', '/faq', 'faq'), array('Contact', '/contact', 'contact'), ); foreach ($pages_to_create as $item) { $page_id = bluetone_create_page_if_not_exists($item[0], $item[2]); wp_update_nav_menu_item($menu_id, 0, array( 'menu-item-title' => esc_html( $item[0] ), 'menu-item-url' => get_permalink($page_id), 'menu-item-status' => 'publish', )); } // Define o novo menu como o menu principal do tema $locations = get_theme_mod('nav_menu_locations'); $locations['primary_menu'] = $menu_id; set_theme_mod('nav_menu_locations', $locations); } add_action('after_setup_theme', 'bluetone_create_or_update_menus'); /* Theme credit link */ define('bluetone_BUY_NOW', 'https://realtimethemes.com/theme/bluetone'); define('bluetone_PRO_DEMO', 'https://preview.realtimethemes.com/bluetone/'); define('bluetone_REVIEW', 'https://realtimethemes.com/theme/bluetone'); define('bluetone_SUPPORT', 'https://realtimethemes.com/'); ?>