Андрей Д.
34 сообщения
#5 лет назад
У плагина  есть возможность вывода данных через следующий код:
<?php  $args = array(
'range' => 'all',
'excerpt_length' => 55,
'posts_per_page' => 10,
'thumbnail_width' => 225,
'thumbnail_height' => 135,
'wpp_start' => '<ul class="wpp-grid">',
'post_html' => '<li>{thumb_img} {title}</li>'
);

wpp_get_mostpopular( $args );
?>

Я пытаюсь добавить в предыдущий код следующее:
if ( $custom_query->have_posts() ) :    while( $custom_query->have_posts() ) : $custom_query->the_post(); ?>

<article <?php post_class(); ?>>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>
<div><?php the_excerpt(); ?></div>
</article>

<?php
endwhile;
?>

и плюс пагинацию
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>

Но в итоге получаю 500 ошибку. Я в php полный 0, видимо, где-то портачу. Мой полный код, который выдает ошибку такой:
<?php  $args = array(
'range' => 'all',
'excerpt_length' => 55,
'posts_per_page' => 10
);

$custom_query = wpp_get_mostpopular( $args );
if ( $custom_query->have_posts() ) :
while( $custom_query->have_posts() ) : $custom_query->the_post(); ?>

<article <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(215, 130, true)); ?></a>
<h2 class="title-main"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div><?php the_excerpt(); ?></div>
</article>

<?php
endwhile;
?>

<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>

?>

Буду благодарен за помощь и подсказки, как правильно отредактировать код.
Елена Б.
6863 сообщения
#5 лет назад
Для начала, у вас, кажется, не закрыт if. Смотрю с телефона, не очень удобно, потому, может, я просто не нашла нужный endif