在主页上显示WordPress图库,就像使用easy FancyBOX发布文章一样

在主页上显示WordPress图库,就像使用easy FancyBOX发布文章一样,wordpress,function,post,fancybox,gallery,Wordpress,Function,Post,Fancybox,Gallery,我试图在主页上显示WordPress图库,但在贴子页面上也有同样的效果。基本上就是当你点击一个帖子时在主页上显示画廊帖子。我解释问题: 当我点击post_thumb,在家里展示我喜欢这个show me,这篇文章中的画廊附件。这是我的代码: <ul id="rb-grid" class="list rb-grid"> <?php $number = 0; query_posts('category_name=atracci

我试图在主页上显示WordPress图库,但在贴子页面上也有同样的效果。基本上就是当你点击一个帖子时在主页上显示画廊帖子。我解释问题:

当我点击post_thumb,在家里展示我喜欢这个show me,这篇文章中的画廊附件。这是我的代码:

                <ul id="rb-grid" class="list rb-grid">

            <?php $number = 0; query_posts('category_name=atracciones-home'); if(have_posts()): ?>
                <?php while(have_posts()): the_post(); ?>
                    <li>
                    <!-- <a data-fancybox-group="gallery" class="item fancybox" href="<?php the_permalink(); ?>"> -->
                    <a data-fancybox-group="gallery" class="item fancybox iframe" href="<?php get_attachment_link(); ?>">


                            <?php
                                if ( has_post_thumbnail() )
                                    the_post_thumbnail('home-atracciones');
                                else
                            echo '<img src="' . trailingslashit( get_template_directory_uri() ) . 'img/default-thumbnail.png' . '" alt="" />';
                            ?>



                            <div class="over" id="gallery-atracciones">
                                <h2 class="page-title" title="<?php the_title(); ?>"><?php the_title(); ?><span class="border"></span></h2>                     
                            </div>




                        </a>
                    </li>
                <?php endwhile; ?>
            <?php endif; wp_reset_query(); ?>
            </ul>
  • 需要检查的是家()

    
    
  •  <?php
        if ( is_home() ) {
            // This is the blog posts index
    
      <ul id="rb-grid" class="list rb-grid">
    
                <?php $number = 0; query_posts('category_name=atracciones-home'); if(have_posts()): ?>
                    <?php while(have_posts()): the_post(); ?>
                        <li>
                        <!-- <a data-fancybox-group="gallery" class="item fancybox" href="<?php the_permalink(); ?>"> -->
                        <a data-fancybox-group="gallery" class="item fancybox iframe" href="<?php get_attachment_link(); ?>">
    
    
                                <?php
                                    if ( has_post_thumbnail() )
                                        the_post_thumbnail('home-atracciones');
                                    else
                                echo '<img src="' . trailingslashit( get_template_directory_uri() ) . 'img/default-thumbnail.png' . '" alt="" />';
                                ?>
    
    
    
                                <div class="over" id="gallery-atracciones">
                                    <h2 class="page-title" title="<?php the_title(); ?>"><?php the_title(); ?><span class="border"></span></h2>                     
                                </div>
    
                            </a>
                        </li>
                    <?php endwhile; ?>
                <?php endif; wp_reset_query(); ?>
                </ul>
        } else {
            // This is not the blog posts index
            get_sidebar();
        }
        ?>