M
M
m_izmailov2016-10-12 20:58:23
API
m_izmailov, 2016-10-12 20:58:23

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

2 answer(s)
D
Denis Yanchevsky, 2016-10-12
@deniscopro

Good.
WordPress has a REST API that returns json.

S
Sergey, 2016-10-12
@goodwin74

$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 question

Ask a Question

731 491 924 answers to any question