0

What I want to achieve is, If there is feature image then show specific <div class="has-featured-image">.

What I have tried or thought ?

I thought of using jQuery to achieve that. Like if there is specific class of feature image is present there, then show <div class='has-featured-image'>, which logically works.

But the issue that I am facing is:

1> If admin removes the featured image, then how can I modify the same DIV with <div class="no-feature-image>"? because the jquery I am inserting is based on DOM ready.

Other thing that I have tried

Other thing I thought of to use wordpress condition of has_post_thumbnail, but the issue is, it only work if admin refresh the page or comes to that page 1st time.

Is it possible to achieve ?

If anybody can give me start then It would be great.

Thanks in advance.

Twix
  • 387
  • 3
  • 15
  • has_post_thumbnail() function is not restricted by admin. its working in frontend. Its depand on hows you implemented. – jogesh_pi Apr 04 '15 at 07:17
  • I want to use it in admin only. But the issue is if Feature image is already there so at that time, it will show `
    ` but what if user remove that Featured image ?
    – Twix Apr 04 '15 at 07:21
  • It can be possible with the AJAX but I am confused with what click event should I call my AJAX? Do you have any idea ? @jogesh_pi – Twix Apr 04 '15 at 07:24
  • You can add a listenner to WP elements that allow to add / remove the featured image, then do what you need. Or use a DOM change listenner as explained here http://stackoverflow.com/questions/2844565/is-there-a-jquery-dom-change-listener – RafH Apr 04 '15 at 07:56

0 Answers0