Last active
March 6, 2021 20:52
-
-
Save aslamhindko/e56b06f06cedbf6794772bbdf47c4a94 to your computer and use it in GitHub Desktop.
Post Type Loop
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
<div class="testimonial"> | |
<?php | |
$q = new WP_Query( | |
array('post_type' => array('testimonials'), | |
'post_status' => array('publish'), | |
'orderby' => 'date', | |
'order' => 'ASC', | |
'posts_per_page' => $sitem, | |
'service-category' => $category) | |
); | |
?> | |
<?php while ($q->have_posts()) : $q->the_post(); ?> | |
<div class="item"> | |
<?php $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(),'full', true); ?> | |
<img src="<?php echo $thumbnail[0]; ?>"> | |
<span><?php the_title(); ?></span> | |
<div class="testicnt"> | |
<p><?php echo get_the_content(); ?></p> | |
</div> | |
</div> | |
<?php endwhile; ?> | |
</div> | |
<?php | |
$q = new WP_Query( | |
array('post_type' => array('slider'), | |
'post_status' => array('publish'), | |
'orderby' => 'date', | |
'order' => 'DESC', | |
'posts_per_page' => $sitem, | |
'service-category' => $category) | |
); | |
?> | |
<?php while ($q->have_posts()) : $q->the_post(); ?> | |
<?php if (has_post_thumbnail()): $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(),'full', true); ?> | |
<img src="<?php echo $thumbnail[0]; ?>" class="img-responsive"> | |
<?php else: ?> | |
<img src="" class="img-responsive"> | |
<?php endif ?> | |
<h3 class="mbottom"><?php the_title(); ?></h3> | |
<p><?php the_excerpt(); ?></p> | |
<?php endwhile; ?> | |
<!-- BG Image Loop --> | |
<?php | |
$q = new WP_Query( | |
array('post_type' => array('main_slider'), | |
'post_status' => array('publish'), | |
'orderby' => 'date', | |
'order' => 'DESC', | |
'posts_per_page' => $sitem, | |
'service-category' => $category) | |
); | |
?> | |
<?php while ($q->have_posts()) : $q->the_post(); ?> | |
<?php | |
if(has_post_thumbnail()){ | |
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(),'full', true); | |
?> | |
<div class="item" style="background: url('<?php echo $thumbnail[0] ?>') no-repeat;background-size: cover;background-position: 50% 50%;background-repeat: no-repeat;background-attachment: fixed;"> | |
<?php }else{ ?> | |
<div class="item" style="background: black;background-size: cover;background-position: 50% 50%;background-repeat: no-repeat;background-attachment: fixed;"> | |
<?php } ?> | |
<div class="caption"> | |
<div class="container"> | |
<h3><?php the_title(); ?></h3> | |
<hr> | |
<?php the_content(); ?> | |
</div> | |
</div> | |
</div> | |
<?php endwhile; ?> | |
<!-- ek post type or 2 loop --> | |
<section class="testimonial"> | |
<div class="container"> | |
<div class="col-md-8 col-md-offset-2"> | |
<h3>TESTIMONIALS</h3> | |
<hr> | |
<div id="bx-pager" class="testislider"> | |
<ul> | |
<?php | |
$q = new WP_Query( | |
array('post_type' => array('testimonials'), | |
'post_status' => array('publish'), | |
'orderby' => 'date', | |
'order' => 'DESC', | |
'posts_per_page' => 4, | |
'service-category' => $category) | |
); | |
?> | |
<?php | |
$count = 0; | |
while ($q->have_posts()) : $q->the_post(); ?> | |
<?php if (has_post_thumbnail()): $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(),'full', true); ?> | |
<li><a data-slide-index="<?php echo $count; ?>" href=""><img src="<?php echo $thumbnail[0]; ?>" /></a></li> | |
<?php $count++; ?> | |
<?php else: ?> | |
<li><a data-slide-index="<?php echo $count; ?>" href=""><img src="<?php echo get_template_directory_uri(); ?>/assets/images/testimonial-default" /></a></li> | |
<?php $count++; ?> | |
<?php endif ?> | |
<?php endwhile; ?> | |
</ul> | |
</div> | |
<ul class="bxslider"> | |
<?php | |
$q = new WP_Query( | |
array('post_type' => array('testimonials'), | |
'post_status' => array('publish'), | |
'orderby' => 'date', | |
'order' => 'DESC', | |
'posts_per_page' => 4, | |
'service-category' => $category) | |
); | |
?> | |
<?php while ($q->have_posts()) : $q->the_post(); ?> | |
<li> | |
<h4><?php the_title(); ?></h4> | |
<?php the_excerpt(); ?> | |
</li> | |
<?php endwhile; ?> | |
</ul> | |
</div> | |
</div> | |
</section> | |
<!--Videos Loop --> | |
<div class="row home-video-section"> | |
<?php | |
$q = new WP_Query( | |
array( | |
'post_type' => array('videos'), | |
'order' => 'DESC', | |
'posts_per_page' => 4, | |
) | |
); | |
?> | |
<?php while ($q->have_posts()) : $q->the_post(); ?> | |
<div class="col-md-6"> | |
<?php $value = get_field( "youtube_video_id" ); ?> | |
<?php if ($value): ?> | |
<iframe src="https://www.youtube.com/embed/<?php echo $value; ?>" frameborder="0" allowfullscreen></iframe> | |
<?php else: ?> | |
There is no video inside | |
<?php endif ?> | |
</div> | |
<?php ?> | |
<?php endwhile; ?> | |
</div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment