Advertisement
pusatdata

PHP: Jika input kosong, maka tidak muncul

Sep 24th, 2016
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. MASTER KALAU KOSONG TIDAK MUNCUL
  2. <!-- Let's show our custom fields here -->
  3.  
  4. sendiri:
  5. <?php
  6. $my_isbn = get_post_meta( get_the_ID(), 'isbn', true);
  7. if( ! empty( $my_isbn ) ) {
  8. echo '<p>ISBN: ' . $my_isbn . '</p>';
  9. }
  10. ?>
  11.  
  12.  
  13. digabung:
  14. <?php
  15. $my_preview = get_post_meta( get_the_ID(), 'preview', true);
  16. $my_isbn = get_post_meta( get_the_ID(), 'isbn', true);
  17. if( ! empty( $my_preview ) ) {
  18. echo '<h3>Download: <a href="' . $my_preview . '" target="_blank">Link</a><h3>';
  19. }
  20. if( ! empty( $my_isbn ) ) {
  21. echo '<p>ISBN: ' . $my_isbn . '</p>';
  22. }
  23. ?>
  24. <!-- End showing our custom fields here -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement