How To Detect Whether The First Two Paragraphs of A Post Contains An Image?
-
I want to left align An adsense block when my content starts. That’s easily achieved through CSS but there is a slight problem.
On some of my posts I have used images in the beginning of the article. I have doubts if I left align the Adsense block, the images might be placed right adjacent to it (which is a violation).
What I want is
1. Detect whether a given post has a left or right aligned image in the first two paragraphs.
2. If there is an image, no ads will be shown. If there is no image in the first two paragraphs, ads will be shown.
I just need a function which can check whether the first two paras of a post contains an <img> tag. That’ll do
I tried some plugins like Adsense injector but neither of them worked. Any help will be much appreciated
- The topic ‘How To Detect Whether The First Two Paragraphs of A Post Contains An Image?’ is closed to new replies.