Estoy trabajando en una búsqueda. Estoy tratando de buscar el producto por etiqueta o categoría. Probé el siguiente código pero no funciona. estoy obteniendo
Nada Encontrado
Además, el siguiente código funciona solo con el título y el contenido.
¿Me ayudarías con esto?
<?php
/**
* The template for displaying search results pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
*
* @package CoolPickings
*/
get_header();
?>
<section id="primary" class="content-area mainSearch">
<main id="main" class="site-main">
<div class="equalPadding">
<div class="cp-seeWrapper">
<?php
if ( have_posts() ) :
?>
<div class="row">
<?php
while (have_posts()){the_post();?>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-xs-12 ">
<div class="cp-shadow cp-seeSinglePostWrapper">
<?php the_post_thumbnail();?>
<div class="bg-white single-post-box">
<div class="d-flex cp-CategoryList">
<div class="seeDate"><?php echo get_the_date('F j, Y'); ?></div>
<div class="cp_cat_list">
<?php $cat = get_the_category();
?>
<a href="https://stackoverflow.com/questions/59300576/<?php echo esc_url( get_category_link( $cat[0]->term_id ) );?>"><?php echo $cat[0]->cat_name?></a><?php //the_category('');
?>
</div>
</div>
<div class="cp-b-content"><h2><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( the_title_attribute( 'echo=0' ) ); ?>"><?php echo wp_trim_words(get_the_title(), 12, '...'); ?></a></h2></div>
<p><?php echo wp_trim_words(get_the_excerpt(), 25, '...'); ?></p>
</div>
</div>
</div>
<?php } ?>
<?php //endwhile;
//the_posts_navigation();
else :
get_template_part( 'template-parts/content', 'none' );
endif;
?>
</div>
</div>
</div>
</main><!-- #main -->
</section><!-- #primary -->
<?php
get_sidebar();
get_footer();
.