clubdeuce / wp-google-maps
WordPress 的 Google Maps 库。
0.4.1
2023-03-21 01:36 UTC
Requires
- php: >=7.4
Requires (Dev)
- consolidation/robo: ^1.1
- johnpbloch/wordpress: ~6.0.0
- mockery/mockery: ^1.5
- natxet/cssmin: ~3.0
- patchwork/jsqueeze: ^2.0
- php-coveralls/php-coveralls: ^2.5
- phpunit/phpunit: ^9
- yoast/phpunit-polyfills: ^1.0
README
WordPress 的 Google Maps 库。
安装
该项目可以通过 Composer 安装
composer require clubdeuce\wp-google-maps
简单地从您的 vendor
目录包含 autoload.php
文件,库将被包含。
使用方法
一个简单的示例
use Clubdeuce\WPGoogleMaps\Google_Maps;
Google_Maps::initialize();
// Register the conditions under which to load the necessary javascript
// You can use WP specific ( e.g. is_single, is_search, etc ) or any
// valid callback function or closure.
Google_Maps::register_script_condition( 'is_single' );
//Create a new map object
$map = Google_Maps::make_new_map();
//Create a new marker object
$marker = Google_Maps::make_marker_by_address( '1600 Pennsylvania Ave NW Washington DC' );
//Set the info window content
$marker->info_window()->set_content( 'The White House' );
//Add the marker to the map
$map->add_marker( $marker );
//Render the map
$map->the_map();