gpt4 book ai didi

php - WordPress 画廊问题

转载 作者:行者123 更新时间:2023-11-28 07:08:24 25 4
gpt4 key购买 nike

我正在编辑 wordpress 主题,我有一个问题,即主题显示页面上的所有图像我想立即设置一个 data-filter = ".1"在页面加载时出现,而不是显示所有图像仅在 data-filter = ".1"下的图像我用该名称命名了第一个过滤器

我做了 data-filter=".1",data-filter=".2",data-filter=".3",data-filter=".4",data-filter=".5",数据过滤器=“.6”,数据过滤器=“.7”我希望页面首先将 data-filter=".1"显示为“事件”

我要全部删除';并设为默认值 1';

这是现在 http://postimg.org/image/x9atfq5of/

我要这个 http://postimg.org/image/729mjrnen/

这是代码,如果我需要更多代码,请告诉我:

 <?php global $tx_switch ?>

<?php if($tx_switch['section_portfolio_display']) : ?>
<!-- Portfolio Start
================================================== -->
<section id="portfolio">
<div class="container">
<div class="row">
<div class="section-title wow bounceIn" data-wow-delay=".2s">
<h1><?php echo $textarea = $tx_switch['section_portfolio_title']; ?></h1>
<p><?php echo $textarea = $tx_switch['section_portfolio_subtitle']; ?></p>
</div> <!-- /.Section title -->
<div id="portfolio-body" class="col-md-12 wow fadeInUp" data-wow-delay=".6s" >
<?php
$terms = get_terms('filters');
$count = count($terms);
if ( $count > 0 ){
echo '<ul class="portfolio-filter" id="projects-filter">';
echo '<li data-filter="*" class="active">all</li>';
foreach ( $terms as $term ) {
$termname = strtolower($term->name);
$termname = str_replace(' ', '-', $termname);
echo '<li data-filter="' . '.' . $termname . '">' . $term->name . '</li>';

}
echo '</ul>';
}
?>
<div class="portfolio-container" >
<ul id="da-thumbs" class="da-thumbs " >
<?php
$args = array(
'post_type' => 'portfolio',
'post_status' => 'publish',
);

$portfolio_query = new WP_Query( $args );?>
<?php while($portfolio_query->have_posts()): $portfolio_query->the_post(); ?>

<li <?php echo post_class();?>>
<a>
<img src="<?php echo $text = get_post_meta( $post->ID, '_tx_portfolio_img', true ); ?>">
<div></div>
</a>
<span class="portfolio-buttons">
<a class="test-popup-link" href="<?php echo $text = get_post_meta( $post->ID, '_tx_portfolio_img', true ); ?> " >
<i class="fa fa-search"></i>
</a>

</span>
</li>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
</ul> <!-- /.da-thumbs -->
</div> <!-- /.portfolio container -->
</div> <!-- /.col-md-12 -->

</div> <!--/row -->
</div> <!-- /.container -->
</section> <!-- /#Portfolio -->
<?php endif ; ?>

最佳答案

要删除所有选项,您可以删除该行

echo '<li data-filter="*" class="active">all</li>';

要限制显示的图片数量,您可以将 $args 更改为

$args = array(
'post_type' => 'portfolio',
'post_status' => 'publish',
'posts_per_page' => 7,
'paged' => $current_page // set this to whatever page the user clicks on, 1 by default
);

关于php - WordPress 画廊问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32807091/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com