if listing has no image(s), then do not display placeholder image – possible ?

This topic contains 8 replies, has 3 voices, and was last updated by  step8601 8 years, 10 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #68552

    step8601
    Expired Member
    Post count: 215

    i think for my dir that if a listing does not have any main image or images that i do not want to display a placeholder image

    rather, just display the listing title and the tabs and the sidebar contact stuff, etc, and just collapse the display as if there is/are no main image(s) there

    is this possible? i didn’t see example of this in the demo

    many thanks

    #68832

    Paolo
    Site Admin
    Post count: 31206

    It is not, I’m sorry.

    #68938

    step8601
    Expired Member
    Post count: 215

    i understand

    hmmmm, what if i made the default image for the listing page a small thin image, like 400×10 (or whatever)

    is this default image used anywhere else, like hompage sliders? (i don’t think so)

    perhaps this could work to collapse the listing detail page, but hmmmmm, wonder if google would look at this as spam, like a 1×1 image(?)

    thanks

    #68977

    Paolo
    Site Admin
    Post count: 31206

    It will not work… Using a smaller image will not collapse anything.

    Thanks

    #69109

    step8601
    Expired Member
    Post count: 215

    what about some css to hide things if no image(s)?

    for example, i used ff firebug a bit and found that if i removed the geo flex container div, the detail page still looked okay:

    http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/places/united-states/pennsylvania/philadelphia/hotels/alexander-inn/?utm_referrer=http%3A%2F%2Fwordpressmu-3822-8567-17899.cloudwaysapps.com%2Ftry-geodirectory%2F

    might there be a way to put in a conditional like “if no image(s), then hide flex container div”

    
    
    <div class="geodir_flex-container">
                <div class="geodir_flex-loader" style="display: none;"><i class="fa fa-refresh fa-spin"></i></div>
                <div class="geodir_flexslider  flexslider-ltr" id="geodir_slider" style="visibility: visible;">
                    
                <div class="geodir-viewport" style="overflow: hidden; position: relative;"><ul class="geodir-slides clearfix" style="width: 2600%; transition-duration: 0.6s; transform: translate3d(-2700px, 0px, 0px);"><li class="clone" aria-hidden="true" style="width: 675px; float: left; display: block;"><img style="max-height:7px;margin:0 auto;" title="hotels2" alt="hotels2" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/plugins/geodirectory/geodirectory-assets/images/spacer.gif" draggable="false"><img style="max-height:400px;margin:0 auto;" title="hotels2" alt="hotels2" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels27.jpg" draggable="false"></li><li style="width: 675px; float: left; display: block;" class=""><img style="max-height:7px;margin:0 auto;" title="hotels11" alt="hotels11" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/plugins/geodirectory/geodirectory-assets/images/spacer.gif" draggable="false"><img style="max-height:400px;margin:0 auto;" title="hotels11" alt="hotels11" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels118.jpg" draggable="false"></li><li style="width: 675px; float: left; display: block;" class=""><img style="max-height:7px;margin:0 auto;" title="hotels10" alt="hotels10" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/plugins/geodirectory/geodirectory-assets/images/spacer.gif" draggable="false"><img style="max-height:400px;margin:0 auto;" title="hotels10" alt="hotels10" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels105.jpg" draggable="false"></li><li style="width: 675px; float: left; display: block;" class=""><img style="max-height:7px;margin:0 auto;" title="hotels12" alt="hotels12" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/plugins/geodirectory/geodirectory-assets/images/spacer.gif" draggable="false"><img style="max-height:400px;margin:0 auto;" title="hotels12" alt="hotels12" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels126.jpg" draggable="false"></li><li style="width: 675px; float: left; display: block;" class="geodir-active-slide"><img style="max-height:7px;margin:0 auto;" title="hotels4" alt="hotels4" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/plugins/geodirectory/geodirectory-assets/images/spacer.gif" draggable="false"><img style="max-height:400px;margin:0 auto;" title="hotels4" alt="hotels4" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels47.jpg" draggable="false"></li><li style="width: 675px; float: left; display: block;"><img style="max-height:7px;margin:0 auto;" title="hotels1" alt="hotels1" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/plugins/geodirectory/geodirectory-assets/images/spacer.gif" draggable="false"><img style="max-height:400px;margin:0 auto;" title="hotels1" alt="hotels1" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels119.jpg" draggable="false"></li><li style="width: 675px; float: left; display: block;"><img style="max-height:7px;margin:0 auto;" title="hotels6" alt="hotels6" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/plugins/geodirectory/geodirectory-assets/images/spacer.gif" draggable="false"><img style="max-height:400px;margin:0 auto;" title="hotels6" alt="hotels6" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels67.jpg" draggable="false"></li><li style="width: 675px; float: left; display: block;"><img style="max-height:7px;margin:0 auto;" title="hotels7" alt="hotels7" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/plugins/geodirectory/geodirectory-assets/images/spacer.gif" draggable="false"><img style="max-height:400px;margin:0 auto;" title="hotels7" alt="hotels7" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels77.jpg" draggable="false"></li><li style="width: 675px; float: left; display: block;"><img style="max-height:7px;margin:0 auto;" title="hotels8" alt="hotels8" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/plugins/geodirectory/geodirectory-assets/images/spacer.gif" draggable="false"><img style="max-height:400px;margin:0 auto;" title="hotels8" alt="hotels8" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels87.jpg" draggable="false"></li><li style="width: 675px; float: left; display: block;"><img style="max-height:7px;margin:0 auto;" title="hotels9" alt="hotels9" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/plugins/geodirectory/geodirectory-assets/images/spacer.gif" draggable="false"><img style="max-height:400px;margin:0 auto;" title="hotels9" alt="hotels9" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels97.jpg" draggable="false"></li><li style="width: 675px; float: left; display: block;"><img style="max-height:7px;margin:0 auto;" title="hotels1" alt="hotels1" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/plugins/geodirectory/geodirectory-assets/images/spacer.gif" draggable="false"><img style="max-height:400px;margin:0 auto;" title="hotels1" alt="hotels1" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels120.jpg" draggable="false"></li><li style="width: 675px; float: left; display: block;"><img style="max-height:7px;margin:0 auto;" title="hotels2" alt="hotels2" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/plugins/geodirectory/geodirectory-assets/images/spacer.gif" draggable="false"><img style="max-height:400px;margin:0 auto;" title="hotels2" alt="hotels2" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels27.jpg" draggable="false"></li><li style="width: 675px; float: left; display: block;" class="clone" aria-hidden="true"><img style="max-height:7px;margin:0 auto;" title="hotels11" alt="hotels11" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/plugins/geodirectory/geodirectory-assets/images/spacer.gif" draggable="false"><img style="max-height:400px;margin:0 auto;" title="hotels11" alt="hotels11" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels118.jpg" draggable="false"></li></ul></div><ol class="geodir-control-nav geodir-control-paging"><li><a class="">1</a></li><li><a class="">2</a></li><li><a class="">3</a></li><li><a class="geodir-active">4</a></li><li><a>5</a></li><li><a>6</a></li><li><a>7</a></li><li><a>8</a></li><li><a>9</a></li><li><a>10</a></li><li><a>11</a></li></ol><ul class="geodir-direction-nav"><li><a href="#" class="geodir-prev">Previous</a></li><li><a href="#" class="geodir-next">Next</a></li></ul></div>
                                <div class="geodir_flexslider flexslider-ltr" id="geodir_carousel" style="visibility: visible;">
                        
                    <div class="geodir-viewport" style="overflow: hidden; position: relative;"><ul class="geodir-slides clearfix" style="width: 2200%; transition-duration: 0s; transform: translate3d(0px, 0px, 0px);"><li style="width: 73px; float: left; display: block;" class=""><img style="max-height:48px;margin:0 auto;" title="hotels11" alt="hotels11" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels118.jpg" draggable="false"></li><li style="width: 73px; float: left; display: block;" class=""><img style="max-height:48px;margin:0 auto;" title="hotels10" alt="hotels10" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels105.jpg" draggable="false"></li><li style="width: 73px; float: left; display: block;" class=""><img style="max-height:48px;margin:0 auto;" title="hotels12" alt="hotels12" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels126.jpg" draggable="false"></li><li style="width: 73px; float: left; display: block;" class="geodir-active-slide"><img style="max-height:48px;margin:0 auto;" title="hotels4" alt="hotels4" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels47.jpg" draggable="false"></li><li style="width: 73px; float: left; display: block;"><img style="max-height:48px;margin:0 auto;" title="hotels1" alt="hotels1" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels119.jpg" draggable="false"></li><li style="width: 73px; float: left; display: block;"><img style="max-height:48px;margin:0 auto;" title="hotels6" alt="hotels6" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels67.jpg" draggable="false"></li><li style="width: 73px; float: left; display: block;"><img style="max-height:48px;margin:0 auto;" title="hotels7" alt="hotels7" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels77.jpg" draggable="false"></li><li style="width: 73px; float: left; display: block;"><img style="max-height:48px;margin:0 auto;" title="hotels8" alt="hotels8" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels87.jpg" draggable="false"></li><li style="width: 73px; float: left; display: block;"><img style="max-height:48px;margin:0 auto;" title="hotels9" alt="hotels9" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels97.jpg" draggable="false"></li><li style="width: 73px; float: left; display: block;"><img style="max-height:48px;margin:0 auto;" title="hotels1" alt="hotels1" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels120.jpg" draggable="false"></li><li style="width: 73px; float: left; display: block;"><img style="max-height:48px;margin:0 auto;" title="hotels2" alt="hotels2" src="http://wordpressmu-3822-8567-17899.cloudwaysapps.com/try-geodirectory/wp-content/uploads/sites/16/2015/05/hotels27.jpg" draggable="false"></li></ul></div></div>
                        </div>
    #69112

    Paolo
    Site Admin
    Post count: 31206

    With css you can only hide that space in both cases, with or without image.
    With PHP you could do what you want with a customization, but it not that simple…

    Thanks

    #69113

    step8601
    Expired Member
    Post count: 215

    thanks paolo

    i won’t beat a dead horse but i found the following javascript just now too, a jquery solution is provided too:

    https://www.sitepoint.com/community/t/if-empty-hide-divs/4190/3

    Paul_WilkinsAdvisor
    Sep ’08

    The traditional javascript way is as follows:

    
    
    var els = document.getElementsByTagName('div'),
        el,
        i;
    for (i = 0; i < els.length; i += 1) {
        if (el.className === 'more') {
            if (!el.firstChild) {
                el.style.display = 'none';
            }
        }
    }

    In jquery that would be something like

    $('#div.more:empty').hide();
    #114456

    Anonymous

    Hi

    Did the JS route work for you?

    I have the same wish and wonder if your solution will work for us?

    Many thanks
    Martin

    #114631

    step8601
    Expired Member
    Post count: 215

    i haven’t had a chance to try, switching hosts, but would love to know if anyone can get something like this to work

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

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount