Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1246134
    lexidev
    Participant

    Is it possible to assign a featured image globally (via code or css) for all posts that have no specific featured image assigned? It should be possible to replace that global default image by using the insert featured image dialog in each individual post. This would look great in a site where there are over 1000 legacy articles without images.
    Can it be done?

    #1246462
    Rad
    Moderator

    Hi there,

    Thanks for writing.

    As fall back background, yes possible. But to insert images automatically isn’t possible with CSS.

    Would you mind providing your site’s URL that has this post with no featured image? It can be done through .no-post-thumbnail but I’m not sure how it should be displayed. (eg. top the headline, below the headline, as masonry, and etc.)

    Thanks!

    #1247479
    lexidev
    Participant
    This reply has been marked as private.
    #1247747
    Friech
    Moderator

    Hi There,

    You can add this under Custom > Global JavaScript in the Customizer.

    jQuery( document ).ready(function() {
      jQuery('<div class="entry-thumb"><img width="100%" src="IMAGE URL HERE" class="img-defaultfeatured" alt="feature image"></div>').insertBefore(".no-post-thumbnail .entry-featured");
    });

    Replace the IMAGE URL HERE string with your actual image URL.

    Thanks.

    #1247832
    lexidev
    Participant

    Thank you so much, Friech. This works exactly as I wished it would. You can replace the default with another image and it displays as it should. Am thrilled.

    #1247843
    Nico
    Moderator

    Happy to hear that.

    Feel free to ask us again.

    Thanks.

  • <script> jQuery(function($){ $("#no-reply-1246134 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>