Get started
Lambo for Developers
In this example, we’ll show you how to grab the 5 most recent articles from our platform’s API. The code snippet below is a quick way to get live content into your app, whether you’re building a blog, news feed, or just experimenting with our platform.
define('WP_USE_THEMES', FALSE);
require('/backend/api.php');
// Endpoint reference : https://https://lamboxtra.com/dev/documentation/
$args = array(
'posts_per_page' => 5 // Specify how many articles you'd like to display
);
$latest_posts = new WP_Query( $args );
if ( $latest_posts->have_posts() ) {
while ( $latest_posts->have_posts() ) {
$latest_posts->the_post(); ?>
<li>
<a href="<?php the_permalink();" title="the_title(); ?>"><?php the_title(); ?></a>
<?php the_excerpt(); ?>
</li>
<?php }
}
else {
echo '<p>There are no articles</p>';
}
wp_reset_postdata();
wp_reset_query();
What's new
// php if (have_posts()) : while (have_posts()) : the_post(); ?>
// php the_content(); ?>// php endwhile; ?> // php endif; ?>