Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8248

    I use the Broadscope theme and my pages contain code for a feed that displays content so I don’t add featured images as I don’t want them in the page. The problem is the pages can be found in search results on my site but there is an empty thumbnail that appears in the results listing. Is it possible to designate a thumbnail for a page if there are no images used in the content area?

    Thank you for the excellent support provided on this site.

    #60797

    This is the second time I’ve heard someone asking about this same problem in the last few days. Then I checked my search results and discovered the same blank SPANs on the left with no images, and I didn’t like it either. My solution, for what it’s worth, was to create a 48×48 pixel image–I used a stylized version of the station logo–to use as a default fallback for when there are no images. Personally, I think that this is an option that should be added to the Avia framework. Anyway, here’s how I did it:

    Open the loop-search.php file in the BroadScope includes folder and find the following code:

    if( is_array($slides) && !empty( $slides[0]['slideshow_image'] ) )
    {
    $image = avia_image_by_id($slides[0]['slideshow_image'], 'widget', 'image');
    }

    Add this code right below it:

    else
    {
    $image = '<img src="http://www.example.com/wp-content/uploads/default.jpg" width="48" height="48" alt="Insert appropriate ALT text." />';
    }

    The result will look something like this:

    if( is_array($slides) && !empty( $slides[0]['slideshow_image'] ) )
    {
    $image = avia_image_by_id($slides[0]['slideshow_image'], 'widget', 'image');
    }
    else
    {
    $image = '<img src="http://www.example.com/path/to/image/default.jpg" width="48" height="48" alt="Insert appropriate ALT text." />';
    }

    Be sure to replace the image URL, path, and name along with the ALT text to work for your image. You might want to change the same code in the class-framework-widgets.php file in the framework/php folder as well. Hope this helps.

    #60798

    Thanks ptvguy. That is a good solution!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Thumbnail without showing photo in content area’ is closed to new replies.