首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FacetWP是刹车砌体布局

FacetWP是刹车砌体布局
EN

Stack Overflow用户
提问于 2017-08-28 20:25:59
回答 2查看 838关注 0票数 0

我正在使用FacetWP构建一个过滤器表单。不幸的是,当我选择表单中的任何选项时,我的masonry布局是制动的。结果显示为单一列,而不是3列。奇怪的是,F5使顺序(3列)正确。

我试图使用以下方法:https://facetwp.com/documentation/template-configuration/和这个:https://facetwp.com/using-facetwp-with-existing-template-files/

我的代码是

代码语言:javascript
复制
        <div id="primary" class="content-area col-md-9 <?php echo sydney_blog_layout(); ?>">
        <main id="main" class="post-wrap" role="main">


        <?php
        $args = array(
            'post_type' => 'nieruchomosci',
            'posts_per_page' => 12,
        );
        $query = new WP_Query( $args );?>
        <?php if ( $query->have_posts() ) : ?>

            <header class="page-header">
                <h3 class="archive-title">Szukaj nieruchomości</h3>
            </header><!-- .page-header -->
                <div class="wyszukiwarka"><?php echo facetwp_display( 'facet', 'rodzaj' ); ?><?php echo facetwp_display( 'facet', 'typ' ); ?><?php echo facetwp_display( 'facet', 'lokalizacja' ); ?></div>
            <div class="posts-layout facetwp-template">
            <?php while ( $query->have_posts() ) : $query->the_post(); ?>

                <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    <?php if ( has_post_thumbnail() && ( get_theme_mod( 'index_feat_image' ) != 1 ) ) : ?>
        <div class="entry-thumb">
            <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('sydney-large-thumb'); ?></a>
        </div>
    <?php endif; ?>

    <header class="entry-header">
        <?php the_title( sprintf( '<h2 class="title-post entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
    </header><!-- .entry-header -->

    <div class="entry-post">
                <?php the_field('cena'); ?> PLN | <?php the_field('powierzchnia'); ?> m<sup>2</sup></br>
                <?php echo get_the_term_list( $post->ID, 'rodzaj', '', ', ', '' ) ?> na <?php echo get_the_term_list( $post->ID, 'typ', '', ', ', '' ) ?> w miejscowości <?php echo get_the_term_list( $post->ID, 'lokalizacja', '', ', ', '' ) ?>
        <?php
            wp_link_pages( array(
                'before' => '<div class="page-links">' . __( 'Pages:', 'sydney' ),
                'after'  => '</div>',
            ) );
        ?>
    </div><!-- .entry-post -->

    <footer class="entry-footer">
        <?php sydney_entry_footer(); ?>
    </footer><!-- .entry-footer -->
</article><!-- #post-## -->

            <?php endwhile; ?>
            </div>

            <?php the_posts_navigation(); ?>

        <?php else : ?>

            <?php get_template_part( 'content', 'none' ); ?>

        <?php endif; ?>

        </main><!-- #main -->
    </div><!-- #primary -->

任何建议都会很好。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-12-09 20:37:24

实际上,我让他工作了(使用了砖石包装的v4.1.1和imagesLoaded打包的v3.1.8):

代码语言:javascript
复制
$(document).on('facetwp-loaded', function() {
    var $grid = $( '.grid' ).imagesLoaded( function() {
        $grid.masonry("reloadItems");
        $grid.masonry( {
            itemSelector : '.loop-entry',
            gutter       : 30,
            columnWidth  : 240,
            isAnimated   : true,
            animationOptions : {
                duration : 300,
                easing   : 'easeInOutCirc',
                queue    : false
            }
        });
    });
});
票数 0
EN

Stack Overflow用户

发布于 2017-08-31 17:05:18

尝试在facetwp-loaded事件上重新加载布局。从您的问题,不清楚如何创建砖石布局。假设是masonry.js,您可以在FacetWP完成如下加载时执行布局:

代码语言:javascript
复制
$(document).on('facetwp-loaded', function() {
    // do layout when FacetWP finishes
    $grid.masonry('layout');
});

在这里查看更多https://facetwp.com/documentation/facetwp-loaded/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45926859

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档