Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $posts_[ $id ] = array(
- $posts_[ $id ] = array(
- 'titulo' => get_the_title(),
- 'link' => get_permalink(),
- 'resumo' => get_the_excerpt(),
- 'img' => wp_get_attachment_image_src( get_post_thumbnail_id() , 'full' ),
- 'categoria' => get_the_category(),
- );
- <?php foreach ( $posts_ as $pst ) : ?>
- <?php
- var_dump(get_post_type($id));
- if ( get_post_type($id) == 'programa' ) : ?>
- <li class="card card--program">
- <a class="card__link-post" href="<?php echo $pst[ 'link' ]; ?>">
- <div class="card__content">
- <?php if ( array_key_exists( 'categoria', $pst ) && $pst[ 'categoria' ] ) : ?>
- <h4 class="card__cat"><?php echo $pst[ 'categoria' ][ 'nome' ]; ?></h4>
- <?php endif; ?>
- <?php if ( $pst[ 'titulo' ] ) : ?>
- <h3 class="card__title"><?php echo $pst[ 'titulo' ]; ?></h3>
- <?php endif; ?>
- <?php if ( $pst[ 'resumo' ] ) : ?>
- <p class="card__desc"><?php echo $pst[ 'resumo' ]; ?></p>
- <?php endif; ?>
- </div>
- <?php if ( $pst[ 'img' ] ) : ?>
- <figure class="card__figure">
- <img class="card__thumb" src="<?php echo $pst[ 'img' ]; ?>" alt="#titulo-card">
- </figure>
- <?php endif; ?>
- </a>
- </li>
- <?php else: ?>
- <li class="card card--sem">
- <a class="card__link-post" href="<?php echo $pst[ 'link' ]; ?>">
- <div class="card__content">
- <?php if ( array_key_exists( 'categoria', $pst ) && $pst[ 'categoria' ] ) : ?>
- <h4 class="card__cat"><?php echo $pst[ 'categoria' ][ 'nome' ]; ?></h4>
- <?php endif; ?>
- <?php if ( $pst[ 'titulo' ] ) : ?>
- <h3 class="card__title"><?php echo $pst[ 'titulo' ]; ?></h3>
- <?php endif; ?>
- <?php if ( $pst[ 'resumo' ] ) : ?>
- <p class="card__desc"><?php echo $pst[ 'resumo' ]; ?></p>
- <?php endif; ?>
- </div>
- <?php if ( $pst[ 'img' ] ) : ?>
- <figure class="card__figure">
- <img class="card__thumb" src="<?php echo $pst[ 'img' ]; ?>" alt="#titulo-card">
- </figure>
- <?php endif; ?>
- </a>
- </li>
- <?php endif; ?>
- <?php endforeach; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement