• Resolved tille

    (@tille)


    In the widget settings the checkbox for showing the featured image is not set –?and the image is (as expected) not showing. However I still get the code generated like this:

    <div class="fpw-featured-image"></div>

    How can I check if the option is set or not set? Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author mrwweb

    (@mrwweb)

    @tille

    Can you tell me what you’re actually trying to do? The widget includes CSS that hides an empty div like that so it doesn’t impact the layout.

    Plugin Author mrwweb

    (@mrwweb)

    @tille please let me know more details about your problem and what you’re trying to do. Otherwise, I’ll assume you were able to get this working and mark this issue as resolved in the next few days if I don’t hear from you.

    Plugin Author mrwweb

    (@mrwweb)

    Marking this as resolved since I haven’t heard back.

    Thread Starter tille

    (@tille)

    Hi Mark,
    thank you for your replies –?and sorry that I didn’t answer…?I guess I was a bit confused how the plugin works.?
    When I first installed FPW, I also edited the templates –?and it could well be that I left some empty space inside the div “fpw-featured-image” –?that would explain why the css didn’t recognize the div as ’empty’.

    .fpw-page-title:empty, 
    .fpw-featured-image:empty, 
    .fpw-excerpt:empty {
        display: none;
    }

    Anyways –?since I am now using the divs with background-images, they are basically always “empty”. But I found my way round using a simple check if the image is actually present ( if ( has_post_thumbnail() ) { …) and they either showing or hiding the div with php unstead of css.

    …so basically everything is fine now. Thank you very much!
    Best regards
    till

    Plugin Author mrwweb

    (@mrwweb)

    Thanks for the update, and I’m glad you figured it out.

    You’re right that any white space between tags makes :empty not work. The default templates are built to work with that, but it’s awfully finicky.

    has_post_thumbnail() is probably a good solution, so I’m glad you found it. Just for clarity of anyone else who sees this post, using that tag tells whether the featured post has a thumbnail set, not whether the widget instance has the “Show Thumbnail” option checked.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How do I check if “show featured image” is set?’ is closed to new replies.