Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
18 views2 pages

Caro Suel

The document contains PHP code for a WordPress carousel that displays featured posts. It sets up a query to retrieve posts from the 'featured' category and attempts to create a carousel with indicators and controls. However, the code is commented out and not functional as is.

Uploaded by

compnetworxxx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

Caro Suel

The document contains PHP code for a WordPress carousel that displays featured posts. It sets up a query to retrieve posts from the 'featured' category and attempts to create a carousel with indicators and controls. However, the code is commented out and not functional as is.

Uploaded by

compnetworxxx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

<!

--Begin Carosuel COding-->


<?php

$args = array(
'post_type' => 'post',
'category_name' => 'featured'
);
$the_query = new WP_Query( $args );

?>
<!-- Carosuel Code Start but this code not worked-->

<div id="carousel-example-generic" class="carousel slide" data-


ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<!--Opening Loop-->
<?php if ( have_posts() ) : while ( $the_query->have_posts() ) :
$the_query->the_post(); ?>

<li data-target="#carousel-example-generic" data-slide-to="<?php echo


$the_query->current_post; ?>" class="<?php if( $the_query->current_post == 0 ):?
>active<?php endif; ?>"></li>
<!--closing loop-->
<?php endwhile; endif; ?>
</ol>

<?php rewind_posts(); ?>

<!-- Wrapper for slides -->


<div class="carousel-inner">

<?php if ( have_posts() ) : while ( $the_query->have_posts() ) :


$the_query->the_post(); ?>

<div class="item <?php if( $the_query->current_post == 0 ):?>active<?


php endif; ?>">

<?php
$thumbnail_id = get_post_thumbnail_id();
$thumbnail_url = wp_get_attachment_image_src( $thumbnail_id,
'thumbnail-size', true );
$thumbnail_meta = get_post_meta( $thumbnail_id,
'_wp_attachment_image_alt', true);
?>

<a href="<?php the_permalink(); ?>"><img src="<?php echo


$thumbnail_url[0]; ?>" alt="<?php echo $thumbnail_meta['alt'] ?>"></a>
<div class="carousel-caption"><?php the_title(); ?></div>
</div>

<?php endwhile; endif; ?>

</div>

<!-- Controls -->


<a class="left carousel-control" href="#carousel-example-generic" data-
slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-
slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div-->

<!-- Carosuel Code Ends-->

You might also like