我正在编辑wordpress主题,我有一个问题,主题显示页面上的所有图像我想立即设置数据过滤器="。 1"当页面加载时出现,并且不显示所有图像仅显示在data-filter ="下的图像。 1"我用该名称命名了第一个过滤器
我制作了数据过滤器=" .1",data-filter =" .2",data-filter =" .3",data-filter =" 0.4",数据过滤器=" 0.5",数据过滤器=" 0.6",数据过滤器=" 0.7&# 34; 我希望页面显示data-filter =" .1"首先是"活跃"
我要删除全部&#39 ;;并默认为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 ; ?>
答案 0 :(得分:0)
要删除所有选项,您可以删除该行
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
);