googlechromelabs / wp-third-parties
此包包含了一组类和实用工具,可高效地将第三方库加载到您的WordPress应用程序中。
dev-main
2024-09-10 17:37 UTC
Requires
- php: >=7.2
- googlechromelabs/third-party-capital: dev-main
Requires (Dev)
- brain/monkey: ^2.6
- dealerdirect/phpcodesniffer-composer-installer: ^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0
- mockery/mockery: ^1.4
- phpcompatibility/php-compatibility: ^9.3
- phpmd/phpmd: ^2.9
- phpstan/extension-installer: ^1.2
- phpstan/phpstan: ^1.10
- slevomat/coding-standard: ^8.9
- szepeviktor/phpstan-wordpress: ^1.1
- wp-coding-standards/wpcs: ^3.0.0
- wp-phpunit/wp-phpunit: ^6.1
- yoast/phpunit-polyfills: ^1.0
This package is auto-updated.
Last update: 2024-09-10 17:37:29 UTC
README
此包包含了一组类和实用工具,可高效地将第三方库加载到您的WordPress应用程序中。
使用方法
谷歌分析
$ga = new Google_Chrome_Labs\WP_Third_Parties\Third_Parties\Google_Analytics( array( 'id' => 'G-...', // Replace this with your actual Google Analytics ID. ) ); add_action( 'wp_loaded', array( $ga, 'add_hooks' ) );
谷歌地图嵌入
$gme = new Google_Chrome_Labs\WP_Third_Parties\Third_Parties\Google_Maps_Embed( array( 'mode' => '...', // Provide this and other parameters like 'key', 'q', 'center', etc. ) ); // To actually render the Google Maps Embed, use this. echo $gme->get_html();
YouTube嵌入
$yte = new Google_Chrome_Labs\WP_Third_Parties\Third_Parties\YouTube_Embed( array( 'videoid' => '...', // Replace this with your actual YouTube video ID. ) ); add_action( 'wp_loaded', array( $yte, 'add_hooks' ) ); // To actually render the YouTube Embed, use this. echo $yte->get_html();
入门指南
composer install