Hey @bagrapk!
Great questions! We’ve updated the plugin so you can do exactly this, so the following applies only to 1.4.7 and above.
To use the live map in PHP, you can use the following code:
<?php MMedia_Covid::shortcode_map(['sort' => 'confirmed', 'height' => '250px']); ?>
Depending on what you are doing, you may need to echo
or print
the output to display the map.
The width is determined by the parent container and for dynamic heights, we suggest passing vh
values; 100vh corresponds to 100% of the vertical height of the browser window. This is known as a relative value and you can read more info if you’d like right here: https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units#Relative_length_units
You could also pass 100% height and just style the parent element to taste. This will give you the most control.
Please note that the map defaults to showing the whole world, so if the width is smaller than the height of the contents of the map, then you will see white space at the top until the map is zoomed in. The default initial zoom isn’t currently controllable, so its best to make sure whatever element you’re creating has a ratio that is similar to that of a world map.
I’m marking this closed, but feel free to message us here or open a new topic if you have any more questions!