You are not logged in.

Announcement

*** NOTICE: forum.openstreetmap.org is being retired. Please request a category for your community in the new ones as soon as possible using this process, which will allow you to propose your community moderators.
Please create new topics on the new site at community.openstreetmap.org. We expect the migration of data will take a few weeks, you can follow its progress here.***

#1 2020-09-23 11:00:29

Midrob
Member
Registered: 2020-09-23
Posts: 4

Display a mao on opening that does NOT show the mercator view

Beginner...

Can anyone tell me why when I open a page with a map on it, I see the mercator view i.e. the whole world, with a pin in the middle showing my location?

Sometimes the map will display the local view, but not always, anyone say what I am missing?

If I click zoom 12 times or so, I see the view I want.

Offline

#2 2020-09-23 15:16:05

Viajero Perdido
Member
Registered: 2016-10-13
Posts: 194

Re: Display a mao on opening that does NOT show the mercator view

Midrob wrote:

a page

Please identify with full URL.

Offline

#3 2020-09-23 16:16:55

Midrob
Member
Registered: 2020-09-23
Posts: 4

Re: Display a mao on opening that does NOT show the mercator view

Would prefer not to post URL as just launched and don't want to skew analytics if possible. I have seen this happen before on other sites too.
Is there any way you can set the zoom on opening?

Offline

#4 2020-09-23 17:24:15

SomeoneElse
Member
Registered: 2010-10-13
Posts: 1,601

Re: Display a mao on opening that does NOT show the mercator view

Can you at least tell us which website or app you are talking about?

Offline

#5 2020-09-29 18:38:40

Midrob
Member
Registered: 2020-09-23
Posts: 4

Re: Display a mao on opening that does NOT show the mercator view

Sorry for the delay. We have a Woocommerce site (catalog only - no selling) there are category pages. On each category page is an image of that category product.
The cat page shows the image just fine, but it will not show the ALT tag that is associated with it. There is some filter code in functions.php like this.

add_action( 'woocommerce_archive_description', 'woocommerce_category_image', 2 );
function woocommerce_category_image() {
    if ( is_product_category() || is_woocommerce() ){
	    global $wp_query;
	    $cat = $wp_query->get_queried_object();
	    $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
	    $image = wp_get_attachment_url( $thumbnail_id );
	    if ( $image ) {
		    echo '<img src="' . $image . '" alt="" />';
		}
	}
}

The dev made an error in this code, the Echo line img src + variable is the code that happily displays the image.

However there is an error on the alt= part. Notice no variable to show the alt tag from the image. (This is hoping that this is possible, template has been customised so this may be why it can't be done.)
)
Dev no longer with us so I am unsure as to what the intention was, but it is not right.
It forces a blank/empty alt tag on the cat pages image.

So my question is, can you identify an alt variable that relates to that (category) image?

Offline

#6 2020-09-29 18:44:09

Midrob
Member
Registered: 2020-09-23
Posts: 4

Re: Display a mao on opening that does NOT show the mercator view

Hello Mod, please can you delete the previous question, it's not for this forum! Sorry!!

Offline

Board footer

Powered by FluxBB