Answer the question
In order to leave comments, you need to log in
How to work with the Wordpress API?
Good day to all, I want to create a mobile application based on this framework . I need to display a list of posts using the Wordpress API, how can I do this? After I receive the data, how can I display them?
Thank you all in advance.
Answer the question
In order to leave comments, you need to log in
$query = new WP_Query('cat=4&posts_per_page=999&nopaging=1&orderby=title&order=ASC'); // указываем категорию из которой выводим записи, кол-в записей(если нужно) и убираем пагинацию, делаем сортировку по title или например по id и выбираем в каком порядке будет сортировка.
while($query->have_posts()){ $query->the_post(); //запускаем цикл
?>
<h3><?php the_title(); ?></h3> //заголовок
<?=the_excerpt();?> //краткое описание
<?
} //закрываем цикл
wp_reset_postdata(); // сбрасываем переменную $post
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question