• Resolved baidoc

    (@baidoc)


    Hi there,

    I’ve been trying to make a condition that will do the following: if there is NOT an image selected on ‘Dynamic-featured-image’ Plugin, then show the default Featured Image (from WordPress)

    Would that be possible?

    I’d be starting with the following code:

    <?php
    if( class_exists('Dynamic_Featured_Image') ) {
    global $dynamic_featured_image;
    $featured_images = $dynamic_featured_image->get_featured_images( get_the_ID() );
    foreach( $featured_images as $image ) {
      echo "<header id='masthead' class='site-header' role='banner' style='background-image: url({$image['full']});'>";
    ?>

    https://wordpress.org/plugins/dynamic-featured-image/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ankit Pokhrel

    (@ankitpokhrel)

    Hi @baidoc,

    Yes it is possible. See the section called “I have thousands of post with default featured image functionality but want to add changing thumbnails feature for some of the new post?” at the bottom of this post.

    Regards,
    Ankit

    Plugin Author Ankit Pokhrel

    (@ankitpokhrel)

    Closing due to inactivity.

    Hi mr. Ankit
    🙂

    im using this code to my sidebar.php but the image not showing

    if( class_exists(‘Dynamic_Featured_Image’) ) {
    global $dynamic_featured_image;
    $featured_images = $dynamic_featured_image->get_featured_images( $postId)
    );

    and i var_dump($featured_images);
    the result is Array(0){}

    i hope for your help thank you 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘If no image, show default featured image (fallback)’ is closed to new replies.