Edit in JSFiddle

	jQuery('a:contains("Sponsored")').closest('.post-item').addClass('sponz');
  
  
  	jQuery('a:contains("Blogs")').closest('.product-overlay').addClass('myaddcartUGEvKorzine');
    <div class="post-item">   
      <span class="tags">
          <a href="#">Blogss</a>  
        <h3>Lorem</h3>          
      </span>         
    </div>

    <div class="post-item">   
      <span class="tags">
          <a href="#">Sponsored by Lorem Ipsum</a>            
      </span>       
        <h3>Lorem</h3>
    </div>
    
    
    <div class="product-overlay">
				<a href="/shop/?add-to-cart=789" class="myaddcart">Already in cart - Add Again?</a>				
			</div>
.sponz {
    background:#ccc
}