Сетка WordPress не показывает все сообщения

Я создавал тему WordPress в стиле каменной кладки и наткнулся на дорожный блок, где моя сетка не будет отображать все опубликованные посты.

В настоящее время мои посты на странице настроены на 100 постов, и у меня есть 18 опубликованных постов, но только 8 постов на страницу, а остальные 4 поста отображаются на следующей странице. Я хочу, чтобы все сообщения отображались на одной странице.

Моя главная цель — создать сетку из трех столбцов, которой я достиг. Но мой контент не отображается полностью.

Веб-адрес: http://www.dwaynecrawford.com/themes/

Мой PHP:

    <?php
/**
* The main template file
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* For example, it puts together the home page when no home.php file exists.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Test Theme
* @since 2015 1.0
*/

get_header(); ?>

<section class="work" id="work">
<!--     Begin WP Grid     -->

<div class="masonry">
<?php
$counter = 1; //start counter

$grids = 3; //Grids per row

global $query_string; //Need this to make pagination work/*Setting up our custom query (In here we are setting it to show 12 posts per page and eliminate all sticky posts) */
query_posts($query_string . '&caller_get_posts=1&posts_per_page=12');if(have_posts()) :  while(have_posts()) :  the_post();
?>
<?php
//Show the left hand side column
if($counter == 2) :
?>
<div class="item">

<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail('category-thumbnail'); ?>
</a>

<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
</div>
<?php
//Show the right hand side column
elseif($counter == $grids) :
?>
<div class="item">

<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail('category-thumbnail'); ?>
</a>

<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
</div>
<?php $counter = 0;
endif;
?>
<?php
$counter++;
endwhile;
//Pagination can go here if you want it.
endif;
?>

</div>

<article class="underpost">
<?php posts_nav_link(); ?>
</article>
</section>

CSS:

.masonry {
margin: 0em 0;
padding: 0;
-moz-column-gap: 0em;
-webkit-column-gap: 0em;
column-gap: 0em;
font-size: 0em;
}
.item {
display: inline-block;
background: #fff;
padding: 0px;
padding: 0;
margin: 0 0 0 0;
width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.item:hover {
background-color: black;
opacity: 0.2;
}
.item img {
width: 100%;
height: auto;
}
.item img.attachment-post-thumbnail {
width: 100%;
}
@media only screen and (min-width: 400px) {
.masonry {
-moz-column-count: 1;
-webkit-column-count: 1;
column-count: 1;
}
}
@media only screen and (min-width: 700px) {
.masonry {
-moz-column-count: 2;
-webkit-column-count: 2;
column-count: 2;
}
}
@media only screen and (min-width: 900px) {
.masonry {
-moz-column-count: 3;
-webkit-column-count: 3;
column-count: 3;
}
}
@media only screen and (min-width: 1100px) {
.masonry {
-moz-column-count: 3;
-webkit-column-count: 3;
column-count: 3;
}
}
@media only screen and (min-width: 1280px) {
.wrapper {
width: 1260px;
}
}

0

Решение

Пройдя время, возвращаясь к моей проблеме, я нашел решение.

query_posts($query_string . '&caller_get_posts=1&posts_per_page=12');

Я изменил значение с posts_per_page = 12 на 100 сообщений.

0

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]