Last active
January 9, 2017 09:42
-
-
Save webprogramacion/460dba0837571129da7317a9b050374d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args=array('post_type' => 'product', | |
'post_status' => 'publish', | |
'posts_per_page' => '3', | |
'orderby' => 'date', | |
'order' => 'DESC' | |
); | |
$posts = null; | |
$posts = new WP_Query($args); | |
if( $posts->have_posts() ) | |
{ | |
echo "<div class='ultimos_productos'>"; | |
echo "<ul>"; | |
while ($posts->have_posts()) | |
{ | |
echo "<li>"; | |
$posts->the_post(); | |
$titulo = get_the_title(); | |
$resumen = get_the_excerpt(); | |
$fecha = get_the_date(); | |
$enlace = get_permalink(); | |
$thumb_id = get_post_thumbnail_id(); | |
$thumb_url = wp_get_attachment_image_src($thumb_id,'medium', true); | |
$url_imagen=$thumb_url[0]; | |
echo "<a href='$enlace'><h3>$titulo</h3></a>"; | |
echo "<div class='imagenyresumen'>"; | |
echo "<img class='imagen_producto' src='$url_imagen' /><br />"; | |
echo "<p class='resumen_producto'>$resumen</p>"; | |
echo "</div>"; | |
echo "<p class='masinfo_producto'>"; | |
echo "<a href='$enlace'>Ver más</a>"; | |
echo "</p>"; | |
echo "</li>"; | |
} | |
echo "</ul>"; | |
echo "</div>"; | |
} | |
wp_reset_query(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment