duangaixing1509 2015-09-27 10:44
浏览 113
已采纳

Wordpress画廊问题

I'm editing wordpress theme and I have a problem that theme shows all the images on the page I would like to immediately set up a data-filter = ". 1" that appears on when the page loads, and not to appear all images only images that are under data-filter = ". 1" I named the first filter with that name

I made data-filter=".1",data-filter=".2",data-filter=".3",data-filter=".4",data-filter=".5",data-filter=".6",data-filter=".7" I want page to show data-filter=".1" first as "active"

I want remove all'; and make default 1';

This is now http://postimg.org/image/x9atfq5of/

I want this http://postimg.org/image/729mjrnen/

here is code if I need more code let me know:

 <?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 ; ?>
  • 写回答

1条回答 默认 最新

  • duanlan4801 2015-09-27 19:32
    关注

    To remove the all options, you can remove the line

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

    To limit the number of images you're showing, you can change your $args to

    $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
    );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程