frowdst

page display limit 3

Feb 23rd, 2019
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. $url="https://max-logistics.co.id/Max_BLog/wp-json/wp/v2/posts?per_page=3";
  3. $ch = curl_init();
  4. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  5. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  6. curl_setopt($ch, CURLOPT_URL,$url);
  7. $result=curl_exec($ch);
  8. $posts = json_decode($result, true);
  9. foreach ($posts as $post) { ?>
  10. <?php echo "
  11. <div class='col-md-4 wow fadeInUp'>
  12. <div class='about-col'>
  13. <h2 class='title'>
  14. <a href='info.php?id=".$post['id']."'>
  15. <h5 class='mb-1'>".$post['title']['rendered']."</h5>
  16. <small>".date('F j, Y', strtotime($post['date']))."</small>
  17. </a>
  18. </h2>
  19. ".$post['excerpt']['rendered']."
  20. <a href='info.php?id=".$post['id']."'>Readmore</a>
  21. </div>
  22. </div>";
  23. ?>
  24. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment