0

I want to make a testimonial slider with slick from https://kenwheeler.github.io/slick/. i use WP_Query for get the post with specific category. the slick works finde but it doesn't show the content. This is my PHP code:

   <div  class=" container">
                    <div id="testimoni-carousel" class='row testimoni-carousel' dir="rtl">

                   <?php 
                         $args = array(
                            'post_type'=> 'post',
                            'category_name' => 'komentar'
                          );
                          $query = new WP_Query( $args );

                          if ( $query->have_posts() ) {
                              while ( $query->have_posts() ) { 
                              $query->the_post();
                              ?>
                              <div class='text-center testimoni-teks col-12'>
                                <h2 class='text-white'><?php the_title() ?></h2>   
                                <div class='text-white'><?php the_content() ?></div>

                              </div>
                                <?php
                              }
                              wp_reset_postdata();
                          }
                   ?>
                        </div>
                    </div>

and this my JS file:

jQuery(document).ready(function($) {

$('#testimoni-carousel').slick({
    dots: true,
    slidesToShow: 1,
    slidesToScroll: 1
});

});

enter image description here

0

look at this example structure :

/**
* Section Servises
*/
$servises_info = new WP_query('pagename=правни-услуги');
if ($servises_info -> have_posts() ) :
    while ( $servises_info -> have_posts() ) : $servises_info -> the_post();
                                            // look hire below
                $relayted_post = new WP_query('cat=2&order=ASC');
                /* Start the Loop two */
                while($relayted_post -> have_posts()): $relayted_post -> the_post();
                    $servises_data = get_the_content();

                // make hire you're things

                endwhile;
               // End the posts Servises Loop - loop 2 
     endwhile; 
     // End the page Servises Loop -loop 1

endif;
wp_reset_postdata();
// End the servises  info section 

i recomend to use ID's no names when accses categorys,taxonomis.

And also you have mistakes hire :

<h2 class='text-white'><?php the_title() mising closing row -> ";" ?></h2>   
<div class='text-white'><?php the_content() mising closing row -> ";" ?></div>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.