Site logo

Archived topic

Different posts loops

5 replies · Started by Luizik on January 25, 2018

Viewing posts 1–6 of 6

Hello there!
First of all, thank you very much for you excellent plugin!
Could you help me please.
I want to show posts from different categories on different pages in the same layout i made it in Appearance->Blog.
How can I do it.
I am sorry? I am not strong in coding.

WP-SHOW-POST do not allow to add custom fields to pages.
I used this code to show posts from category 5


<?php
// задаем нужные нам критерии выборки данных из БД
$args = array(
	'cat' => 5,
	'orderby' => 'comment_count',
'post_type' => 'page'
);

$query = new WP_Query( $args );

// Цикл
if ( $query->have_posts() ) {
	while ( $query->have_posts() ) {
		$query->the_post();
		echo '<li>' . get_the_title() . '</li>';
	}
} else {
	// Постов не найдено
}
/* Возвращаем оригинальные данные поста. Сбрасываем $post. */
wp_reset_postdata();

?>

How can I applay the theme settings for this loop?

Making it look the same as the GP blog would involve some custom programming. A plugin like WP Show Posts is definitely the way to go, as it would only take some CSS tweaks to make it look close.

I tried the wp show posts plugin. Could your help me please, I did not find how to show custom fields.

Actually I found your snippet how to add custom fileds. Thank you very much!

Glad you found it :)

This archived topic is closed to new replies.