Created
July 26, 2017 23:43
-
-
Save gydoar/240a11495072bf1728b6db74834f336a to your computer and use it in GitHub Desktop.
Función para el plugin
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 | |
// Creamos la función para mostrarlo desde el frontend | |
function flx_funcion($type='thum-flx') { | |
$args = array( | |
'post_type' => 'flexslider', | |
'posts_per_page' => 5 | |
); | |
$result = '<div class="flexslider">'; | |
$result .= '<ul class="slides">'; | |
// el loop | |
$loop = new WP_Query($args); | |
while ($loop->have_posts()) { | |
$loop->the_post(); | |
$the_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), $type); | |
$result .= '<li>'; | |
$result .= '<img alt="'.get_the_title().'" src="'. $the_url[0] . '" />'; | |
$result .= '</li>'; | |
} | |
$result .= '</ul>'; | |
$result .='</div>'; | |
return $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment