$post->post_content duplication issue
-
I have the following code:
<?php foreach($deptPosts as $post){ if(has_category('dept-mid-'.$page_slug)){ ?> <a href="#"> <div class="col-sm-<?php echo 12/$count_cat ?> mid-blocks"> <div class="white-bg"> <?php the_post_thumbnail(); ?> <h3><?php echo $post->post_title ?></h3> <div class="center-block"> <?php echo $post->post_content; ?> </div> </div> </div><!-- mid-blocks --> </a> <?php } } ?>
So without the anchor tag wrapping around the “mid-blocks” div, everything works fine. But once I put the anchor tag in, it adds many anchor tags instead of one for each post. An example is below:
<a href="#"></a> <div class="col-sm-3 mid-blocks"> <a href="#"></a> <div class="white-bg" style="height: 337px;"> <a href="#"> <img width="224" height="202" alt="fresh-pick-produce" class="attachment-post-thumbnail wp-post-image" src="produce.jpg"> <h3>Fresh Picks</h3> </a> <div class="center-block"> <a href="#"> Find out What’s in Season? </a> <a href="whats-in-season"> MORE FRESH PICKS >></a> </div> </div> </div> <!-- mid-blocks -->
Another weird thing is that when I do ctrl + u to get the source, the html is fine there, but when I look in firebug I see what I put above.
I also noticed that once I take out $post->post_content, it works the way I want. (one anchor tag wrapping around the entire mid-blocks div)
What is my problem? How do I fix this?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘$post->post_content duplication issue’ is closed to new replies.