Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function homeServicios($attr)
- {
- $args_servicios = array(
- 'post_type' => 'servicios',
- 'post_status' => 'publish',
- 'ignore_sticky_posts' => true,
- 'posts_per_page' => -1,
- 'order' => 'ASC'
- );
- // declaro la variable $query_banner para instanciar la clase WP_QUERY
- // que tendra almacenada como parametro $args_servicios.
- $query_servicios = new WP_QUERY( $args_servicios );
- echo '<section>';
- echo '<div id="owl-demo" class="owl-carousel owl-theme">';
- // si tiene post
- if( $query_servicios->have_posts() ):
- // inicio el bucle while para mostrar la lista de servicios
- while( $query_servicios->have_posts() ): $query_servicios->the_post();
- $titulo_servicio = get_field('titulo');
- echo '<div class="item">';
- echo '<figure class="caouselimg">';
- echo '<a href="'.get_permalink().'">';
- echo '<img src="'.get_field('imagen_servicio').'" alt="'.$titulo_servicio.'">';
- echo '</a>';
- echo '</figure>';
- echo '<aside class="carouseldescrip">';
- echo '<h3><a href="'.get_permalink().'">'.$titulo_servicio.'</a></h3>';
- echo '</aside>';
- echo '</div>';
- endwhile;
- endif;
- wp_reset_postdata();
- echo '</div>';
- echo '<div class="customNavigation">';
- echo '<a class="btn prev">Previous</a>';
- echo '<a class="btn next">Next</a>';
- echo '</div>';
- echo '</section>';
- }
- add_shortcode('home-servicios','homeServicios');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement