{"id":3596,"date":"2025-06-12T01:34:50","date_gmt":"2025-06-11T17:34:50","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/wpcms\/wpdt\/3596.html"},"modified":"2025-06-12T01:34:50","modified_gmt":"2025-06-11T17:34:50","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8wordpress%e4%b8%ad%e6%b7%bb%e5%8a%a0%e8%b0%b7%e6%ad%8c%e6%97%a5%e5%8e%86%ef%bc%88%e4%b8%80%e6%ad%a5%e6%ad%a5%e6%8c%87%e5%8d%97%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.zhaozhao123.cn\/wpcms\/post\/3596.html","title":{"rendered":"\u5982\u4f55\u5728WordPress\u4e2d\u6dfb\u52a0\u8c37\u6b4c\u65e5\u5386\uff08\u4e00\u6b65\u6b65\u6307\u5357\uff09"},"content":{"rendered":"<div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--1\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/dyA-1-400x300.jpg\" alt=\"Bug&#32534;&#35793;&#29422;\" class=\"wp-image-1842\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<p class=\"my-0\">Bug&#32534;&#35793;&#29422;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<p>&#35201;&#22312;WordPress&#20013;&#28155;&#21152;&#35895;&#27468;&#26085;&#21382;&#65292;&#20320;&#38656;&#35201;&#36981;&#24490;&#20197;&#19979;&#27493;&#39588;&#65306;<\/p>\n<ol>\n<li>\n<p><strong>&#30331;&#24405;&#21040;&#24744;&#30340;WordPress&#21518;&#21488;<\/strong>&#65306;&#39318;&#20808;&#65292;&#24744;&#38656;&#35201;&#30331;&#24405;&#21040;&#24744;&#30340;WordPress&#31649;&#29702;&#30028;&#38754;&#12290;<\/p>\n<\/li>\n<li>\n<p><strong>&#36873;&#25321;&ldquo;&#35774;&#32622;&rdquo; &gt; &ldquo;&#38405;&#35835;&#21644;&#31038;&#20132;&#23186;&#20307;&#38598;&#25104;&rdquo;<\/strong>&#65306;&#22312;&#24038;&#20391;&#33756;&#21333;&#20013;&#25214;&#21040;&#24182;&#28857;&#20987;&ldquo;&#35774;&#32622;&rdquo;&#65292;&#28982;&#21518;&#36873;&#25321;&ldquo;&#38405;&#35835;&#21644;&#31038;&#20132;&#23186;&#20307;&#38598;&#25104;&rdquo;&#12290;<\/p>\n<\/li>\n<li>\n<p><strong>&#21551;&#29992;Google Calendar API<\/strong>&#65306;<\/p>\n<ul>\n<li>&#22312;&#21491;&#20391;&#30340;&#39029;&#38754;&#19978;&#65292;&#24744;&#20250;&#30475;&#21040;&#19968;&#20010;&#21517;&#20026;&ldquo;Google Calendar&rdquo;&#30340;&#36873;&#39033;&#21345;&#12290;<\/li>\n<li>&#28857;&#20987;&#35813;&#36873;&#39033;&#21345;&#65292;&#28982;&#21518;&#28378;&#21160;&#21040;&#24213;&#37096;&#65292;&#25214;&#21040;&ldquo;Google Calendar API&rdquo;&#37096;&#20998;&#12290;<\/li>\n<li>&#36873;&#25321;&ldquo;&#21551;&#29992;&rdquo;&#20197;&#28608;&#27963;Google Calendar API&#12290;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>&#21019;&#24314;&#24212;&#29992;&#23494;&#38053;<\/strong>&#65306;<\/p>\n<ul>\n<li>&#36825;&#19968;&#27493;&#26159;&#24517;&#38656;&#30340;&#65292;&#22240;&#20026;&#27809;&#26377;&#24212;&#29992;&#23494;&#38053;&#65292;&#20320;&#26080;&#27861;&#36890;&#36807;API&#19982;Google Calendar&#20132;&#20114;&#12290;<\/li>\n<li>&#30331;&#24405;&#21040;Google Cloud Console (<a href=\"https:\/\/www.zhaozhao123.cn\/skin\/go?url=aHR0cHM6Ly9jb25zb2xlLmNsb3VkLmdvb2dsZS5jb20vKSVFRiVCQyU4QyVFNSU4OCU5QiVFNSVCQiVCQSVFNCVCOCU4MCVFNCVCOCVBQSVFNiU5NiVCMCVFNyU5QSU4NCVFOSVBMSVCOSVFNyU5QiVBRSVFNiU4OCU5NiVFOSU4MCU4OSVFNiU4QiVBOSVFNSVCNyVCMiVFNiU5QyU4OSVFNyU5QSU4NCVFOSVBMSVCOSVFNyU5QiVBRQ==\" rel=\"noopener noreferrer nofollow\"><a href=\"https:\/\/www.zhaozhao123.cn\/skin\/go?url=aHR0cHM6Ly9jb25zb2xlLmNsb3VkLmdvb2dsZS5jb20v\" rel=\"noopener noreferrer nofollow\" rel=\"nofollow\">https:\/\/console.cloud.google.com\/<\/a>)&#65292;&#21019;&#24314;&#19968;&#20010;&#26032;&#30340;&#39033;&#30446;&#25110;&#36873;&#25321;&#24050;&#26377;&#30340;&#39033;&#30446;<\/a>&#12290;<\/li>\n<li>&#21019;&#24314;&#26032;&#30340;&#24212;&#29992;&#31243;&#24207;&#31867;&#22411;&#20026;&ldquo;Web Application&rdquo;&#65292;&#28982;&#21518;&#25353;&#29031;&#25351;&#31034;&#23436;&#25104;&#21019;&#24314;&#12290;<\/li>\n<li>&#25509;&#19979;&#26469;&#65292;&#22312;&ldquo;Credentials&rdquo;&#65288;&#20973;&#35777;&#65289;&#37096;&#20998;&#65292;&#28857;&#20987;&ldquo;Create credentials&rdquo;&#65288;&#21019;&#24314;&#20973;&#35777;&#65289;&#65292;&#36873;&#25321;&ldquo;OAuth client ID&rdquo;&#12290;<\/li>\n<li>&#36873;&#25321;&ldquo;Web application&rdquo;&#20316;&#20026;&#31867;&#22411;&#30340;ID&#65292;&#28982;&#21518;&#28857;&#20987;&ldquo;Create&rdquo;&#65288;&#21019;&#24314;&#65289;&#25353;&#38062;&#12290;<\/li>\n<li>&#19979;&#19968;&#27493;&#65292;&#19979;&#36733;<code>client_secrets.json<\/code>&#25991;&#20214;&#65292;&#36825;&#21253;&#21547;&#20102;&#29992;&#20110;&#35748;&#35777;&#30340;&#35814;&#32454;&#20449;&#24687;&#12290;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>&#22797;&#21046;&#24212;&#29992;&#23494;&#38053;&#24182;&#26367;&#25442;&#21040;WordPress&#37197;&#32622;<\/strong>&#65306;<\/p>\n<ul>\n<li>&#23558;&#20174;Google Cloud Console&#19979;&#36733;&#30340;<code>client_secrets.json<\/code>&#25991;&#20214;&#20013;&#30340;&#24212;&#29992;&#23494;&#38053;&#22797;&#21046;&#31896;&#36148;&#21040;WordPress&#30340;&#37197;&#32622;&#25991;&#20214;&#20013;&#12290;<\/li>\n<li>&#25171;&#24320;WordPress&#30340;&#37197;&#32622;&#25991;&#20214;&#65288;&#36890;&#24120;&#26159;<code>wp-config.php<\/code>&#65289;&#65292;&#25214;&#21040;&#31867;&#20284;&#19979;&#38754;&#30340;&#34892;&#65306;\n<pre><code>define('WP_CACHE', true);\ndefine('WPCACHEHOME', '\/path\/to\/wp-content\/plugins\/w3tc\/cache');<\/code><\/pre><\/li>\n<li>&#22312;&#36825;&#20123;&#23450;&#20041;&#21608;&#22260;&#28155;&#21152;&#19968;&#34892;&#26469;&#24341;&#29992;&#24744;&#30340;&#24212;&#29992;&#23494;&#38053;&#65306;\n<pre><code class=\"language-php\">define('WP_GOOGLE_CALENDAR_API_KEY', 'YOUR_APPLICATION_KEY_HERE');<\/code><\/pre><\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>&#27979;&#35797;&#38598;&#25104;<\/strong>&#65306;<\/p>\n<ul>\n<li>&#23436;&#25104;&#19978;&#36848;&#27493;&#39588;&#21518;&#65292;&#24744;&#21487;&#20197;&#23581;&#35797;&#35775;&#38382;&#20219;&#20309;&#21253;&#21547;Google Calendar&#25554;&#20214;&#30340;WordPress&#39029;&#38754;&#65292;&#30475;&#30475;&#26159;&#21542;&#33021;&#22815;&#25104;&#21151;&#36830;&#25509;&#21040;Google Calendar&#12290;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>&#23433;&#35013;&#24182;&#21551;&#29992;Google Calendar&#25554;&#20214;<\/strong>&#65306;<\/p>\n<ul>\n<li>&#24744;&#21487;&#33021;&#36824;&#38656;&#35201;&#23433;&#35013;&#19968;&#20010;&#19987;&#38376;&#29992;&#26469;&#19982;WordPress&#25972;&#21512;Google Calendar&#30340;&#25554;&#20214;&#65292;&#22914;<code>Calendar Integration for WordPress<\/code>&#12290;<\/li>\n<li>&#25554;&#20214;&#36890;&#24120;&#20250;&#25552;&#20379;&#19968;&#20010;&#31616;&#21333;&#30340;&#30028;&#38754;&#65292;&#20801;&#35768;&#24744;&#36731;&#26494;&#22320;&#21516;&#27493;&#26085;&#21382;&#20107;&#20214;&#12289;&#25552;&#37266;&#21644;&#20854;&#20182;&#25968;&#25454;&#12290;<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3>&#31034;&#20363;&#20195;&#30721;<\/h3>\n<p>&#20551;&#35774;&#25105;&#20204;&#24050;&#32463;&#23436;&#25104;&#20102;&#25152;&#26377;&#24517;&#35201;&#30340;&#35774;&#32622;&#65292;&#24182;&#19988;&#25105;&#20204;&#30340;<code>wp-config.php<\/code>&#25991;&#20214;&#20013;&#21253;&#21547;&#20102;&#19968;&#20010;&#26377;&#25928;&#30340;&#24212;&#29992;&#23494;&#38053;&#65292;&#20197;&#19979;&#26159;&#25554;&#20837;&#24212;&#29992;&#23494;&#38053;&#30340;&#31034;&#20363;&#20195;&#30721;&#29255;&#27573;&#65306;<\/p>\n<pre><code class=\"language-php\">\/\/ Define the Google Calendar API key\ndefine('WP_GOOGLE_CALENDAR_API_KEY', 'YOUR_APPLICATION_KEY_HERE');\n\n\/\/ Initialize the Google Calendar library\nrequire_once(ABSPATH . WPINC . '\/class-google-calendar.php');\n\n\/\/ Create a new instance of the Google Calendar class\n$calendar = new Google_Service_Calendar($service_account_email, $private_key_file);\n\n\/\/ Fetch events from your calendar\n$results = $calendar-&gt;events-&gt;listEvents(\n    'primary',\n    array(\n        'timeMin' =&gt; date('c'),\n    )\n);\n\nforeach ($results['items'] as $event) {\n    echo '&lt;h2&gt;' . $event['summary'] . '&lt;\/h2&gt;';\n    echo '&lt;p&gt;' . $event['description'] . '&lt;\/p&gt;';\n}<\/code><\/pre>\n<p>&#36825;&#20010;&#31034;&#20363;&#20195;&#30721;&#23637;&#31034;&#20102;&#22914;&#20309;&#20351;&#29992;Google Calendar API&#20174;&#24744;&#30340;&#20027;&#26085;&#21382;&#33719;&#21462;&#20107;&#20214;&#21015;&#34920;&#12290;&#35831;&#27880;&#24847;&#65292;&#36825;&#21482;&#26159;&#19968;&#20010;&#22522;&#26412;&#31034;&#20363;&#65292;&#23454;&#38469;&#25805;&#20316;&#21487;&#33021;&#20250;&#26681;&#25454;&#24744;&#30340;&#20855;&#20307;&#38656;&#27714;&#21644;&#29615;&#22659;&#26377;&#25152;&#19981;&#21516;&#12290;<\/p>\n<p>&#30830;&#20445;&#24744;&#27491;&#30830;&#22320;&#22635;&#20889;&#20102;&#24212;&#29992;&#23494;&#38053;&#65292;&#24182;&#19988;&#24744;&#30340;Google&#36134;&#25143;&#20855;&#26377;&#30456;&#24212;&#30340;&#26435;&#38480;&#65292;&#20197;&#20415;&#25191;&#34892;&#27492;&#25805;&#20316;&#12290;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div><div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--2\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/zp-400x300.jpg\" alt=\"&#40657;&#26495;&#21069;&#30340;Bug&#35821;&#27861;&#35762;&#24072;\" class=\"wp-image-1849\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<p class=\"my-0\">&#40657;&#26495;&#21069;&#30340;Bug&#35821;&#27861;&#35762;&#24072;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<h3>&#35838;&#31243;&#30446;&#26631;&#65306;<\/h3>\n<p>&#26412;&#35838;&#31243;&#26088;&#22312;&#24110;&#21161;&#29992;&#25143;&#23398;&#20064;&#22914;&#20309;&#20351;&#29992;WordPress&#26469;&#21019;&#24314;&#21644;&#31649;&#29702;&#19968;&#20010;Google Calendar&#25554;&#20214;&#12290;&#36890;&#36807;&#36825;&#20010;&#25945;&#31243;&#65292;&#24744;&#23558;&#33021;&#22815;&#36731;&#26494;&#22320;&#22312;&#24744;&#30340;&#32593;&#31449;&#19978;&#28155;&#21152;Google Calendar&#21151;&#33021;&#65292;&#20197;&#20415;&#29992;&#25143;&#21487;&#20197;&#26597;&#30475;&#20182;&#20204;&#30340;&#26085;&#31243;&#23433;&#25490;&#12290;<\/p>\n<h3>&#25945;&#23398;&#22823;&#32434;&#65306;<\/h3>\n<ol>\n<li><strong>&#24341;&#20837;<\/strong>\n<ul>\n<li>&#31616;&#20171;WordPress&#21644;Google Calendar&#20043;&#38388;&#30340;&#20851;&#31995;&#12290;<\/li>\n<\/ul><\/li>\n<li><strong>&#23433;&#35013;&#19982;&#37197;&#32622;<\/strong>\n<ul>\n<li>WordPress&#20027;&#39064;&#30340;&#36873;&#25321;&#19982;&#23433;&#35013;&#12290;<\/li>\n<li>&#35774;&#32622;Google API&#23494;&#38053;&#12290;<\/li>\n<\/ul><\/li>\n<li><strong>&#28155;&#21152;&#26085;&#21382;<\/strong>\n<ul>\n<li>&#21019;&#24314;&#26032;&#30340;Google Calendar&#12290;<\/li>\n<li>&#22312;WordPress&#20013;&#35774;&#32622;&#26085;&#21382;&#12290;<\/li>\n<\/ul><\/li>\n<li><strong>&#20010;&#24615;&#21270;&#19982;&#23450;&#21046;<\/strong>\n<ul>\n<li>&#33258;&#23450;&#20041;&#26085;&#21382;&#35270;&#22270;&#12290;<\/li>\n<li>&#28155;&#21152;&#33258;&#23450;&#20041;&#26085;&#26399;&#33539;&#22260;&#12290;<\/li>\n<\/ul><\/li>\n<li><strong>&#39640;&#32423;&#21151;&#33021;<\/strong>\n<ul>\n<li>&#21457;&#24067;&#25552;&#37266;&#12290;<\/li>\n<li>&#26085;&#24535;&#35760;&#24405;&#12290;<\/li>\n<\/ul><\/li>\n<li><strong>&#23433;&#20840;&#19982;&#38544;&#31169;<\/strong>\n<ul>\n<li>&#38450;&#27490;&#28389;&#29992;&#26085;&#21382;&#12290;<\/li>\n<li>&#20445;&#25252;&#20010;&#20154;&#25968;&#25454;&#12290;<\/li>\n<\/ul><\/li>\n<li><strong>&#24635;&#32467;<\/strong>\n<ul>\n<li>&#32467;&#21512;&#23454;&#38469;&#26696;&#20363;&#23637;&#31034;&#22914;&#20309;&#24212;&#29992;&#36825;&#20123;&#30693;&#35782;&#12290;<\/li>\n<\/ul><\/li>\n<li><strong>&#32451;&#20064;<\/strong>\n<ul>\n<li>&#23454;&#36341;&#25805;&#20316;&#65292;&#21253;&#25324;&#20294;&#19981;&#38480;&#20110;&#65306;&#35774;&#32622;&#26085;&#21382;&#12289;&#21457;&#24067;&#25552;&#37266;&#31561;&#12290;<\/li>\n<\/ul><\/li>\n<\/ol>\n<h3>&#31034;&#20363;&#20195;&#30721;<\/h3>\n<h4>1. &#23433;&#35013;WordPress&#20027;&#39064;&#24182;&#35774;&#32622;Google API&#23494;&#38053;<\/h4>\n<p>&#39318;&#20808;&#65292;&#20320;&#38656;&#35201;&#36873;&#25321;&#19968;&#20010;&#21512;&#36866;&#30340;WordPress&#20027;&#39064;&#65292;&#28982;&#21518;&#23433;&#35013;&#23427;&#21040;&#20320;&#30340;&#26381;&#21153;&#22120;&#19978;&#12290;&#36825;&#37324;&#25105;&#20204;&#20197;&ldquo;Hello World&rdquo;&#20026;&#20363;&#65306;<\/p>\n<pre><code class=\"language-html\">&lt;a href=\"https:\/\/wordpress.org\/themes\/hello-world\/\"&gt;\n  &lt;img src=\"https:\/\/wpf.com\/images\/theme-hello-world.png\" alt=\"Hello World Theme\" \/&gt;\n&lt;\/a&gt;<\/code><\/pre>\n<p>&#25509;&#19979;&#26469;&#65292;&#33719;&#21462;Google API&#23494;&#38053;&#65292;&#36825;&#21487;&#20197;&#36890;&#36807;Google Cloud Console&#23436;&#25104;&#65306;<\/p>\n<ul>\n<li>&#30331;&#24405;Google Cloud Console (<a href=\"https:\/\/www.zhaozhao123.cn\/skin\/go?url=aHR0cHM6Ly9jb25zb2xlLmNsb3VkLmdvb2dsZS5jb20v\" rel=\"noopener noreferrer nofollow\">https:\/\/console.cloud.google.com\/<\/a>)<\/li>\n<li>&#25628;&#32034; &#8220;APIs &amp; Services&#8221; &#24182;&#28857;&#20987; &#8220;Dashboard&#8221;<\/li>\n<li>&#22312;&#24038;&#20391;&#33756;&#21333;&#26639;&#20013;&#25214;&#21040; &#8220;Credentials&#8221; &#24182;&#28857;&#20987; &#8220;Create credentials&#8221;<\/li>\n<\/ul>\n<p>&#36873;&#25321; &#8220;OAuth client ID&#8221; &#24182;&#25353;&#29031;&#25552;&#31034;&#22635;&#20889;&#30456;&#20851;&#20449;&#24687;&#12290;<\/p>\n<h4>2. &#21019;&#24314;&#26032;Google Calendar<\/h4>\n<ul>\n<li>&#30331;&#24405;&#21040;Google&#20113;&#31471;&#24179;&#21488; (<a href=\"https:\/\/www.zhaozhao123.cn\/skin\/go?url=aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS9jbG91ZC1wbGF0Zm9ybQ==\" rel=\"noopener noreferrer nofollow\">https:\/\/www.google.com\/cloud-platform<\/a>)<\/li>\n<li>&#25171;&#24320; &#8220;App Engine SDK for Python&#8221; &#24182;&#19979;&#36733;&#26368;&#26032;&#29256;&#26412;<\/li>\n<li>&#36816;&#34892;&#20197;&#19979;&#21629;&#20196;&#20197;&#21019;&#24314;&#19968;&#20010;&#26032;&#30340;Calendar:\n<pre><code class=\"language-python\">\nfrom google.oauth2 import service_account\nimport googleapiclient.discovery\nfrom googleapiclient.errors import HttpError<\/code><\/pre><\/li>\n<\/ul>\n<h1>&#26367;&#25442;&#20026;&#20320;&#30340;&#26381;&#21153;&#36134;&#21495;&#25991;&#20214;&#21517;<\/h1>\n<p>service_account_file = &#8216;path\/to\/service-account.json&#8217;<\/p>\n<h1>&#26367;&#25442;&#20026;&#20320;&#30340;Google API&#23494;&#38053;<\/h1>\n<p>credentials = service_account.Credentials.from_service_account_file(service_account_file)<\/p>\n<h1>&#26367;&#25442;&#20026;&#20320;&#30340;Google API URL<\/h1>\n<p>calendar_url = &#8216;<a href=\"https:\/\/www.zhaozhao123.cn\/skin\/go?url=aHR0cHM6Ly93d3cuZ29vZ2xlYXBpcy5jb20vY2FsZW5kYXIvdjMvY2FsZW5kYXJz\" rel=\"noopener noreferrer nofollow\">https:\/\/www.googleapis.com\/calendar\/v3\/calendars<\/a>&#8216;\ncalendar_id = &#8216;your_calendar_id&#8217; # &#26367;&#25442;&#20026;&#20320;&#30340;CalenderID<\/p>\n<p>try:<\/p>\n<h1>&#33719;&#21462;&#24403;&#21069;&#26102;&#38388;&#25139;<\/h1>\n<pre><code>now = datetime.datetime.utcnow().isoformat() + 'Z'  # 'Z' indicates UTC time\nprint(f\"Getting the upcoming events for calendar {calendar_id}...\")\nresponse = requests.get(calendar_url, headers={'Authorization': f'Bearer {credentials.token}'}, params={'singleEvents': True, 'maxResults': 100, 'timeMin': now})\nevents_result = response.json()\nprint(events_result)<\/code><\/pre>\n<p>except HttpError as e:\nprint(&#8216;An error occurred: %s&#8217; % e)<\/p>\n<pre><code>&#27880;&#24847;&#65306;&#30830;&#20445;&#26367;&#25442;&#19978;&#36848;&#20195;&#30721;&#20013;&#30340; `service_account_file` &#21644; `your_calendar_id`&#12290;\n\n#### 3. &#22312;WordPress&#20013;&#28155;&#21152;Google&#26085;&#21382;\n\n&#22312;WordPress&#20013;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;&#25554;&#20214;&#25110;&#33258;&#23450;&#20041;&#20989;&#25968;&#26469;&#23454;&#29616;&#36825;&#19968;&#21151;&#33021;&#12290;&#19979;&#38754;&#25105;&#20204;&#23558;&#20351;&#29992;WordPress&#25554;&#20214;&ldquo;Google Calendar&rdquo;&#26469;&#28436;&#31034;&#22914;&#20309;&#28155;&#21152;Google&#26085;&#21382;&#12290;\n\n**&#27493;&#39588; 1:** &#23433;&#35013;&#24182;&#28608;&#27963;&ldquo;Google Calendar&rdquo;&#25554;&#20214;&#12290;\n```bash\nsudo wp plugin install https:\/\/github.com\/AlexanderBolotov\/google-calendar\/archive\/master.zip\nsudo wp activate google-calendar-master<\/code><\/pre>\n<p><strong>&#27493;&#39588; 2:<\/strong> &#23558;Google&#26085;&#21382;API&#30340;&#23494;&#38053;&#22797;&#21046;&#24182;&#31896;&#36148;&#21040;WordPress&#20027;&#39064;&#30340;<code>functions.php<\/code>&#25991;&#20214;&#20013;&#12290;<\/p>\n<pre><code class=\"language-php\">add_action( 'init', 'google_calendar_init' );\nfunction google_calendar_init(){\n    $client = new Google_Client();\n    $client-&gt;setClientId('YOUR_CLIENT_ID');\n    $client-&gt;setClientSecret('YOUR_CLIENT_SECRET');\n    $client-&gt;setRedirectUri('http:\/\/localhost\/wp-admin\/google_calendar\/oauth2callback');\n    $client-&gt;setScopes(array(\n        'https:\/\/www.googleapis.com\/auth\/calendar',\n    ));\n\n    $url = $client-&gt;createAuthUrl();\n    echo '&lt;script type=\"text\/javascript\"&gt;';\n    echo 'document.write('&lt;a href=\"' . htmlspecialchars($url) . '\" id=\"login\"&gt;Login with Google Calendar&lt;\/a&gt;') ;\n    echo '&lt;\/script&gt;';\n}<\/code><\/pre>\n<p><strong>&#27493;&#39588; 3:<\/strong> &#20351;&#29992;&#25554;&#20214;&#25552;&#20379;&#30340;&#25509;&#21475;&#21019;&#24314;&#21644;&#26356;&#26032;Google&#26085;&#21382;&#20107;&#20214;&#12290;<\/p>\n<pre><code class=\"language-php\">$events = array(\n    array(\n        'summary' =&gt; 'Test Event',\n        'start' =&gt; array(\n            'dateTime' =&gt; '2023-09-01T08:00:00+00:00',\n            'timeZone' =&gt; 'Europe\/London',\n        ),\n        'end' =&gt; array(\n            'dateTime' =&gt; '2023-09-01T09:00:00+00:00',\n            'timeZone' =&gt; 'Europe\/London',\n        ),\n    ),\n);\n\n$api = new Google_Service_Calendar($client);\nforeach ($events as $event) {\n    try {\n        $response = $api-&gt;events()-&gt;insert(\n            body = array(\n                'summary' =&gt; $event['summary'],\n                'start' =&gt; $event['start']['dateTime'] . 'Z',\n                'end' =&gt; $event['end']['dateTime'] . 'Z',\n            )\n        )-&gt;execute();\n        echo 'Event created successfully.';\n    } catch (Exception $e) {\n        echo 'Event creation failed: ' . $e-&gt;getMessage();\n    }\n}\n\n\/\/ Update an existing event\ntry {\n    $eventId = 'YOUR_EVENT_ID';\n    $updateBody = array(\n        'summary' =&gt; 'Updated Event',\n        'start' =&gt; array(\n            'dateTime' =&gt; '2023-09-01T08:00:00+00:00',\n            'timeZone' =&gt; 'Europe\/London',\n        ),\n        'end' =&gt; array(\n            'dateTime' =&gt; '2023-09-01T09:00:00+00:00',\n            'timeZone' =&gt; 'Europe\/London',\n        ),\n    );\n    $response = $api-&gt;events()-&gt;update(\n        eventId,\n        $updateBody\n    )-&gt;execute();\n    echo 'Event updated successfully.';\n} catch (Exception $e) {\n    echo 'Event update failed: ' . $e-&gt;getMessage();\n}<\/code><\/pre>\n<p><strong>&#27880;&#24847;&#20107;&#39033;&#65306;<\/strong><\/p>\n<ol>\n<li>&#35831;&#30830;&#20445;&#22312;&#20351;&#29992;Google API&#20043;&#21069;&#65292;&#24050;&#32463;&#33719;&#24471;&#30456;&#24212;&#30340;&#35775;&#38382;&#26435;&#38480;&#12290;<\/li>\n<li>&#20026;&#20102;&#38450;&#27490;&#24694;&#24847;&#25915;&#20987;&#65292;Google Calendar&#25554;&#20214;&#21487;&#33021;&#20250;&#23545;&#26576;&#20123;&#31867;&#22411;&#30340;&#35831;&#27714;&#36827;&#34892;&#38480;&#21046;&#12290;<\/li>\n<li>&#22914;&#26524;&#38656;&#35201;&#26356;&#35814;&#32454;&#30340;&#35774;&#32622;&#65292;&#24314;&#35758;&#26597;&#38405;&#25554;&#20214;&#25991;&#26723;&#25110;&#32852;&#31995;&#20316;&#32773;&#23547;&#27714;&#24110;&#21161;&#12290;<\/li>\n<\/ol>\n<p>&#36890;&#36807;&#20197;&#19978;&#27493;&#39588;&#65292;&#20320;&#24212;&#35813;&#33021;&#22815;&#22312;WordPress&#19978;&#25104;&#21151;&#28155;&#21152;Google Calendar&#21151;&#33021;&#12290;&#35831;&#27880;&#24847;&#65292;&#27599;&#20010;&#20855;&#20307;&#30340;&#35774;&#32622;&#37117;&#21487;&#33021;&#26377;&#25152;&#19981;&#21516;&#65292;&#22240;&#27492;&#24314;&#35758;&#26681;&#25454;&#23454;&#38469;&#24773;&#20917;&#35843;&#25972;&#20195;&#30721;&#20197;&#36866;&#24212;&#24744;&#30340;&#38656;&#27714;&#12290;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Bug&#32534;&#35793;&#29422; &#35201;&#22312;WordPress&#20013;&#28155;&#21152;&#35895;&#27468;&#26085;&#21382;&#65292;&#20320;&#38656;&#35201;&#36981;&#24490;&#038;#2..<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[2107,2106],"tuisongtax":[],"class_list":["post-3596","post","type-post","status-publish","format-standard","hentry","category-wpdt","tag-cjyy","tag-cjzn"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/3596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/comments?post=3596"}],"version-history":[{"count":0,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/3596\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/media?parent=3596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/categories?post=3596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tags?post=3596"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tuisongtax?post=3596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}