Skip to content

Instantly share code, notes, and snippets.

@gydoar
Created July 26, 2017 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gydoar/240a11495072bf1728b6db74834f336a to your computer and use it in GitHub Desktop.
Save gydoar/240a11495072bf1728b6db74834f336a to your computer and use it in GitHub Desktop.
Función para el plugin
<?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