I have Around 40 Excerpts on my homepage (I am using Gantry Framework) and I want to style each of these Excerpts in a different Manner. i.e Different Backgrounds, Font color For Every Excerpt.
So How can I add custom Class to each and every excerpt which is there on my homepage...say in manner Excerpt1 , Excerpt2 .... Excerpt40.
This is what I have explored so far: These Excerpts Are being called in a file content-blog.php like this!!
<div class="post-content">
<?php if( $gantry->get( 'blog-content', 'content' ) == 'excerpt' ) : ?>
<?php the_excerpt(); ?>
<?php else : ?>
<?php the_content( false ); ?>
<?php endif; ?>
</div>
So If I do this:
<div class="post-content">
<?php if( $gantry->get( 'blog-content', 'content' ) == 'excerpt' ) : ?>
<div class="sameExcerpt">
<?php the_excerpt(); ?>
</div>
<?php else : ?>
<?php the_content( false ); ?>
<?php endif; ?>
</div>
A single class i.e sameexcerpt
will be assigned to each excerpt. But if can somehow use a global variable or static variable.
and keep incrementing that variable like this:
<div class="sameExcerpt<php echo ++globalvariable">
<?php the_excerpt(); ?>
</div>
<?php else : ?>
<?php the_content( false ); ?>
<?php endif; ?>
</div>
Then I think I can Assign a different Class to Every Excerpt.
Any Help Will Be greatly Appreciated.