我有这个代码的问题,我有几个不同类别的按钮,当你点击它时,它应该根据你选择的类别改变它显示的内容,因为我现在有它,它不会改变它显示的内容,我希望你能帮助我。
这是一个显示问题的视频的链接:https://www.loom.com/share/1371ed7d195544269e28197cafd25407
<?php
?>
<?php get_header(); ?>
<?php get_template_part('template_parts/banner-casos-de-exito') ?>
<section class="section">
<div class="container">
<div class="section__body mt-0">
<div class="grid-history">
<div class="row">
<?php
$terms = get_terms('historias-de-exitos');
$count = count($terms);
if ( $count > 0 )
{
?>
<ul id="filters-2" class="clearfix">
<li><span class="filter active" data-filter=".all">Todos</span></li>
<?php
foreach ( $terms as $term )
{
$termname = strtolower($term->name);
$termname = str_replace(' ', '-', $termname);
echo '<li>
<span class="filter" data-filter="' . '.' . $termname . '">
' . $term->name . '
</span>
</li>';
}
?>
</ul>
<?php
}
?>
</div>
<div class="row">
<?php
$loop = new WP_Query(
array(
'post_type' => 'historias-de-exito',
'posts_per_page' => 3,
'post_status' => 'publish',
'order' => 'DESC',
'ignore_sticky_posts' => true
)
);
$count = 0;
?>
<div id="portfoliolist">
<?php
if ( $loop ) :
while ( $loop->have_posts()) : $loop->the_post();
$imagen__portada__exito = get_field( 'imagen__portada__exito' );
$icono__casos__exito = get_field( 'icono__casos__exito' );
?>
<?php
$terms = get_the_terms( $loop->ID, 'historias-de-exitos' );
if ( $terms && ! is_wp_error( $terms ) ) :
$links = array();
foreach ( $terms as $term )
{
$links[] = $term->name;
}
$links = str_replace(' ', '-', $links);
$tax = join( " ", $links );
$link_category = get_term_link( strtolower($tax), 'historias-de-exitos' );
else :
$tax = '';
endif;
?>
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<div class="content__portafolio <?php echo strtolower($tax); ?> all" data-cat="<?php echo strtolower($tax); ?>">
<img src="<?php echo $imagen__portada__exito; ?>" alt="" class="img-fluid">
<div class="content">
<div class="row">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<h2><?php echo get_the_title(); ?></h2>
<div class="sumilla">
<?php echo the_excerpt(); ?>
</div>
<!-- -->
</div>
</div>
<!-- -->
<div class="row">
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-12">
<a href="<?php echo get_permalink($loop->ID); ?>" class="btn__vermas">saber más</a>
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-6 col-12">
<div class="logo__reiva">
<img src="<?php echo $icono__casos__exito; ?>" alt="" class="img-fluid">
</div>
</div>
</div>
<!-- -->
</div>
<!-- -->
</div>
<!-- -->
</div>
<!-- -->
<?php
endwhile;
endif;
?>
</div>
<!-- -->
<div id="boton">
<a href="javascript:void(0);" id="loadMore" class="btn__sabermas" page="1">Cargar más</a>
</div>
<!-- -->
</div>
<!-- -->
</div>
</div>
</div>
</section>
<div id="scrollUp">
<img src="<?php echo get_template_directory_uri(); ?>/assets/img/arrow-scroll.png" alt="">
</div>
<?php get_footer(); ?>发布于 2021-03-14 02:06:03
您应该尝试使用Ajax来发送和接收数据。有关此检查的示例:jQuery Ajax Post with data
https://stackoverflow.com/questions/66616448
复制相似问题