Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Testimonial_Shortcode_loop_shortcode() {
- ob_start();
- $args = array(
- 'post_type' => 'testimonials',
- 'post_status' => 'publish',
- );
- $my_query = null;
- $my_query = new WP_query($args);
- if ($my_query->have_posts()):
- echo ' <ul class="slickslide">';
- while ($my_query->have_posts()) : $my_query->the_post(); ?>
- <li><?php echo the_content(); ?></li>
- <?php
- endwhile;
- wp_reset_postdata();
- else :
- _e('Sorry, no posts matched your criteria.');
- endif; ?>
- </ul>
- <div class="slick-thumbs">
- <ul>
- <?php $args = array(
- 'post_type' => 'testimonials',
- 'post_status' => 'publish',
- );
- $my_query = null;
- $my_query = new WP_query($args);
- if ($my_query->have_posts()): ?>
- <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
- <li>
- <?php
- if ( has_post_thumbnail() ) {
- the_post_thumbnail('testimonial-thumb-size');
- }
- else {
- $string = get_the_title();
- echo '<span class="fake-testimonial-name">'.$string[0].'</span>';
- } ?>
- </li>
- <?php
- endwhile;
- wp_reset_postdata();
- else :
- _e('Sorry, no posts matched your criteria.');
- endif; ?>
- </ul>
- <?php
- return ob_get_clean();
- }
- add_shortcode('cleere-testimonials', 'Testimonial_Shortcode_loop_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement