Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.61 KB | None | 0 0
  1. $posts_[ $id ] = array(
  2. $posts_[ $id ] = array(
  3. 'titulo' => get_the_title(),
  4. 'link' => get_permalink(),
  5. 'resumo' => get_the_excerpt(),
  6. 'img' => wp_get_attachment_image_src( get_post_thumbnail_id() , 'full' ),
  7. 'categoria' => get_the_category(),
  8. );
  9.  
  10.  
  11. <?php foreach ( $posts_ as $pst ) : ?>
  12. <?php
  13. var_dump(get_post_type($id));
  14. if ( get_post_type($id) == 'programa' ) : ?>
  15. <li class="card card--program">
  16. <a class="card__link-post" href="<?php echo $pst[ 'link' ]; ?>">
  17. <div class="card__content">
  18. <?php if ( array_key_exists( 'categoria', $pst ) && $pst[ 'categoria' ] ) : ?>
  19. <h4 class="card__cat"><?php echo $pst[ 'categoria' ][ 'nome' ]; ?></h4>
  20. <?php endif; ?>
  21. <?php if ( $pst[ 'titulo' ] ) : ?>
  22. <h3 class="card__title"><?php echo $pst[ 'titulo' ]; ?></h3>
  23. <?php endif; ?>
  24.  
  25. <?php if ( $pst[ 'resumo' ] ) : ?>
  26. <p class="card__desc"><?php echo $pst[ 'resumo' ]; ?></p>
  27. <?php endif; ?>
  28. </div>
  29. <?php if ( $pst[ 'img' ] ) : ?>
  30. <figure class="card__figure">
  31. <img class="card__thumb" src="<?php echo $pst[ 'img' ]; ?>" alt="#titulo-card">
  32. </figure>
  33. <?php endif; ?>
  34. </a>
  35. </li>
  36. <?php else: ?>
  37. <li class="card card--sem">
  38. <a class="card__link-post" href="<?php echo $pst[ 'link' ]; ?>">
  39. <div class="card__content">
  40. <?php if ( array_key_exists( 'categoria', $pst ) && $pst[ 'categoria' ] ) : ?>
  41. <h4 class="card__cat"><?php echo $pst[ 'categoria' ][ 'nome' ]; ?></h4>
  42. <?php endif; ?>
  43. <?php if ( $pst[ 'titulo' ] ) : ?>
  44. <h3 class="card__title"><?php echo $pst[ 'titulo' ]; ?></h3>
  45. <?php endif; ?>
  46.  
  47. <?php if ( $pst[ 'resumo' ] ) : ?>
  48. <p class="card__desc"><?php echo $pst[ 'resumo' ]; ?></p>
  49. <?php endif; ?>
  50. </div>
  51. <?php if ( $pst[ 'img' ] ) : ?>
  52. <figure class="card__figure">
  53. <img class="card__thumb" src="<?php echo $pst[ 'img' ]; ?>" alt="#titulo-card">
  54. </figure>
  55. <?php endif; ?>
  56. </a>
  57. </li>
  58. <?php endif; ?>
  59. <?php endforeach; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement