The first post should have its own class, the next three posts should have their own class, and then the rest don’t need a unique class.
<div class="first-post">POST CONTENT</div>
<div class="second-post">POST CONTENT</div>
<div class="third-post">POST CONTENT</div>
<div class="fourth-post">POST CONTENT</div>
<div>POST CONTENT</div>
<div>POST CONTENT</div>
Here is what my code looks like right now:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
$destinations = get_posts(array(
'meta_query' => array(
array(
'key' => 'destination',
'value' => '"' . get_the_ID() . '"',
'compare' => 'LIKE'
)
)
));
?>
<?php if( $destinations ): ?>
<?php foreach( $destinations as $destination ): ?>
<?php $post_class = ('alpha' == $post_class) ? 'omega' : 'alpha'; ?>
<?php $photo = get_field('main_image', $destination->ID); ?>
<div class="<?php echo $post_class; ?>">
<div <?php post_class($style);?> id="post-<?php the_ID();?>">
<div class="post-entry">
<a href="<?php echo get_permalink( $destination->ID ); ?>">
<?php echo get_the_post_thumbnail( $destination->ID, 'grid-thunb' ); ?>
</a>
<h2 class="post-title"><a href="<?php echo get_permalink( $destination->ID ); ?>">
<?php echo get_the_title( $destination->ID ); ?>
</a></h2>
<p><?php $customLength=20; echo get_the_excerpt(); ?></p>
</div>
</div><!-- end of #post-<?php the_ID(); ?> -->
</div><!--end of post class -->
<?php endforeach; ?>
<?php endif; ?>
Really appreciate the help! Thanks!
]]>The page I am referring to is: https://fbclawyers.com/fbc-ranked-4th-by-duns-100/
Obviously this is not a real page but a post page, and I am trying to style the content of the post.
I have a few questions:
1. is this page generated by single.php? if not, what is generating this?
2. I think I have figured out that my content comes from this line:
<?php the_content(); ?>
but every attempt I made to control this by wrapping a div around it did not work. The question: what do I do in order to style this? how do I control this?
thanks,
a
]]>I have no idea how to do this, and is there any sort of tools where I could do any of this visually?
]]>I’ve looked through the forums to try to find an answer but haven’t found one. I’ve figured out most of the styling, and just haven’t finished styling most of my site yet; I’m just hung up on this issue and don’t want to move on until I figure this out.
Thanks for your help WP Community!
]]>