0
I created post_types for the administrative area in Function.php:
// Meus posts types
function meus_posts_type() {
// Testemunhos
register_post_type('testemunhos',
array(
'labels' => array(
'name' => __('Testemunhos'),
'singular_name' => __('Testemunhos')
),
'public' => true,
'has_archive' => true,
'menu_icon' => 'dashicons-format-chat',
'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'),
)
);
register_post_type('consultoria',
array(
'labels' => array(
'name' => __('Consultorias'),
'singular_name' => __('Consultorias')
),
'public' => true,
'has_archive' => true,
'menu_icon' => 'dashicons-clipboard',
'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'),
)
);
register_post_type('treinamentos',
array(
'labels' => array(
'name' => __('Treinamentos'),
'singular_name' => __('Treinamentos')
),
'public' => true,
'has_archive' => true,
'menu_icon' => 'dashicons-welcome-learn-more',
'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'),
)
);
register_post_type('clientes',
array(
'labels' => array(
'name' => __('Clientes'),
'singular_name' => __('Clientes')
),
'public' => true,
'has_archive' => true,
'menu_icon' => 'dashicons-admin-multisite',
'supports' => array('title', 'thumbnail', 'page-attributes'),
)
);
}
add_action( 'init', 'meus_posts_type' );
Also I created 2 page: page-consultorias.php and page-trainings.php.
In my menu, which is not dynamic, I put the links this way:
<section class="menu cid-rlhN7gSbPQ" once="menu" id="menu2-0">
<nav class="navbar navbar-expand beta-menu navbar-dropdown align-items-center navbar-fixed-top navbar-toggleable-sm">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<div class="hamburger">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</button>
<div class="menu-logo">
<div class="navbar-brand">
<span class="navbar-logo">
<a href="<?php bloginfo('url');?>">
<img src="<?php bloginfo('template_url');?>/assets/images/residuo-de-valor-logo-principal-232x123.png" alt="Mobirise" title="" style="height: 8rem;">
</a>
</span>
</div>
</div>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav nav-dropdown" data-app-modern-menu="true">
<li class="nav-item">
<a class="nav-link link text-black display-4" href="<?php bloginfo('url');?>">Início</a>
</li>
<li class="nav-item dropdown open"><a class="nav-link link text-black dropdown-toggle display-4" href="#" data-toggle="dropdown-submenu" aria-expanded="true">Nossos Serviços</a><div class="dropdown-menu"><a class="text-black dropdown-item display-4" href="consultorias">Consultoria</a><a class="text-black dropdown-item display-4" href="treinamentos" aria-expanded="false">Workshops e Treinamentos</a></div></li><li class="nav-item"><a class="nav-link link text-black display-4" href="#">Blog</a></li><li class="nav-item"><a class="nav-link link text-black display-4" href="sobre">Sobre</a></li></ul>
<div class="navbar-buttons mbr-section-btn"><a class="btn btn-sm btn-primary display-4" href="index.html#form1-4">
<span class="btn-icon mbri-mobile mbr-iconfont mbr-iconfont-btn">
</span>Fale com um Consultor</a></div>
</div>
</nav>
</section>
Where this specific section of the menu:
<li class="nav-item dropdown open"><a class="nav-link link text-black dropdown-toggle display-4" href="#" data-toggle="dropdown-submenu" aria-expanded="true">Nossos Serviços</a><div class="dropdown-menu"><a class="text-black dropdown-item display-4" href="consultorias">Consultoria</a><a class="text-black dropdown-item display-4" href="treinamentos" aria-expanded="false">Workshops e Treinamentos</a></div></li>
I place in the href="consultorias"
and href="treinamentos"
.
But the links are not working.
My two referred pages are this way:
page-consultorias.php
<?php
get_header();
/*
Template name: Consultoria
*/
?>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<section class="features18 popup-btn-cards cid-rlWjfrLtP9" id="features18-u">
<div class="container">
<h2 class="mbr-section-title pb-3 align-center mbr-fonts-style display-2"><strong>SOLUÇÕES CONSULTORIA</strong></h2>
<h3 class="mbr-section-subtitle display-5 align-center mbr-fonts-style mbr-light"><strong>GOVERNOS | EMPRESAS | ONGs
</strong><div>Consultoria especializada em gestão integrada de resíduos sólidos
</div><div><br></div></h3>
<?php query_posts( 'post_type=consultoria' ); ?>
<?php if(have_posts()): while(have_posts()): the_post(); ?>
<div class="media-container-row pt-5 ">
<div class="card p-3 col-12 col-md-6 col-lg-4">
<div class="card-wrapper ">
<div class="card-img">
<div class="mbr-overlay"></div>
<div class="mbr-section-btn text-center">
<a href="<?php the_permalink(); ?>" class="btn btn-primary display-4">Saiba Mais</a>
</div>
<img src="<?php the_post_thumbnail_url('thumbnail'); ?>">
</div>
<div class="card-box">
<h4 class="card-title mbr-fonts-style display-7">
<b><a href="<?php the_permalink(); ?>"><?php the_title_attribute(); ?></a></b>
</h4>
<p class="mbr-text mbr-fonts-style align-left display-7">
<?php the_content(); ?>
</p>
</div>
</div>
</div>
<?php endwhile; ?>
<?php else : ?>
<h1>Não há nenhuma consultoria ainda cadastrada.</h1>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
</div>
</section>
<br/><br/><br/><br/>
<?php get_footer(); ?>
And page-training.php
<?php
get_header();
/*
Template name: Treinamentos
*/
?>
<br/><br/><br/><br/>
<section class="features18 popup-btn-cards cid-rlWkB2eQKv" id="features18-y">
<div class="container">
<h2 class="mbr-section-title pb-3 align-center mbr-fonts-style display-2"><strong>WORKSHOPS E TREINAMENTOS</strong></h2>
<h3 class="mbr-section-subtitle display-5 align-center mbr-fonts-style mbr-light"><strong>GOVERNOS | EMPRESAS | ONGs (IN-COMPANY
)</strong><div>Workshops e treinamentos especializados em gestão integrada de resíduos sólidos
</div><div><br></div></h3>
<?php query_posts( 'post_type=treinamentos' ); ?>
<?php if(have_posts()): while(have_posts()): the_post(); ?>
<div class="media-container-row pt-5 ">
<div class="card p-3 col-12 col-md-6 col-lg-4">
<div class="card-wrapper ">
<div class="card-img">
<div class="mbr-overlay"></div>
<div class="mbr-section-btn text-center">
<a href="<?php the_permalink(); ?>" class="btn btn-primary display-4">Saiba Mais</a>
</div>
<img src="<?php the_post_thumbnail_url('thumbnail'); ?>">
</div>
<div class="card-box">
<h4 class="card-title mbr-fonts-style display-7">
<b><a href="<?php the_permalink(); ?>"><?php the_title_attribute(); ?></a></b>
</h4>
<b>Tipo: </b><?php the_field('tipo'); ?>
<p class="mbr-text mbr-fonts-style align-left display-7">
<?php the_content(); ?>
</p>
</div>
</div>
</div>
<?php endwhile; ?>
<?php else : ?>
<h2>Não há Workshops e Treinamentos cadastrados...</h2>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
</div>
</section>
<br/><br/><br/><br/>
<?php get_footer(); ?>
The problem is that when I click on the links they always stay on the home page.
And I don’t understand, because it worked at first, then it just stopped working.
It was a mistake in creating the pages within Wordpress that were with wrong links.
– Ramos