编辑WordPress站点的PHP网格页面

时间:2018-04-03 08:41:30

标签: php wordpress

我想编辑网格艺术家页面只有12位艺术家并登陆制作人部分,而不是所有艺术家。

下面'网站页面的链接:http://cascaderecords.fr/roster/

PHP代码:

<?php
if (ci_setting('artists_isotope') == 'enabled' AND !wp_is_mobile() AND !is_tax() ):
    ?>
    <ul class="filters-nav group">
        <li><a href="#filter" class="selected" data-filter="*"><?php _e('All Artists', 'ci_theme'); ?></a></li>
        <?php
            $args = array('hide_empty' => 1);
            $cats = get_terms('artist-category', $args);
        ?>
        <?php foreach ( $cats as $cat ): ?>
            <li><a href="#filter" data-filter=".<?php echo $cat->slug; ?>"><?php echo $cat->name; ?></a></li>
        <?php endforeach; ?>
    </ul>
    <?php
endif; // is isotope enabled

global $paged;
if ( ci_setting('artists_isotope') == 'enabled' AND !wp_is_mobile() AND !is_tax() ) {
    $args = array(
        'post_type' => 'cpt_artists',
        'posts_per_page' => -1
    );
}   else {
    $args = array(
        'post_type' => 'cpt_artists',
        'posts_per_page' => ci_setting('artists_per_page'),
        'paged' => $paged
    );
}

$the_query = !empty($the_query) ? $the_query : new WP_Query($args);
?>



<article class="row">
<ul class="col-md-12 items-list-grid filter-container <?php echo $filter; ?>">
    <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
        <?php $cats = wp_get_object_terms($post->ID, 'artist-category'); ?>

        <li class="<?php foreach ( $cats as $cat ) : echo $cat->slug.' '; endforeach; echo $grid;  ?>">
            <article id="artist-<?php the_ID(); ?>" <?php post_class('row'); ?>>
                <div class="col-md-12">
                    <?php if ( has_post_thumbnail() ) : ?>
                        <figure>
                            <a href="<?php the_permalink(); ?>">
                                <?php the_post_thumbnail('ci_thumb_square'); ?>
                            </a>
                        </figure>
                    <?php endif; ?>


                    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>

                </div><!-- /col-md-12 -->
            </article><!-- /row -->
        </li><!-- /col-md-4 -->
    <?php endwhile; wp_reset_postdata(); ?>
</ul>

1 个答案:

答案 0 :(得分:0)

尝试更改:

'posts_per_page' => -1

为:

'posts_per_page' => 12

不确定“ci_setting('artists_per_page')”在下面的变量中是什么,需要更多信息:

'posts_per_page' => ci_setting('artists_per_page'),