# wordpress各種問題排除 ## jquery未定義? Uncaught TypeError: $ is not a function https://stackoverflow.com/questions/12258282/typeerror-is-not-a-function-wordpress 這是因為wordpress要防止jquery衝突 (請見以下聯結) https://api.jquery.com/jQuery.noConflict/#jQuery-noConflict-removeAll ### 解法1 把jquery放在特定的區塊中1 ``` jQuery(document).ready(function($) { // your code goes here }); ``` 另一種寫法 ``` (function( $ ) { // Variables and DOM Caching using $. var body = $('body'); console.log(body); })( jQuery ); ``` ### 解法2 重新宣告一個變數來代替$字號 ``` var jExample = jQuery.noConflict(); // Do something with jQuery jExample( "div p" ).hide(); ``` ## 更新失敗 ### wordpress 目前正在執行另一項更新程序。 通過phpmyadmin等工具管理Wordpress數據庫,在wp_options表中找到core_updater.lock記錄並刪除。 http://www.webhek.com/post/another-update-is-currently-in-progresss.html ### briefly unavailable for scheduled maintenance. Check back in a minute. ``` 通過FTP或Web主機的控制面板登錄到您的Web服務器。 找到您的WordPress安裝的根目錄 (你可以看到wp-content,wp-admin和wp-includes的文件夾) 尋找一個叫做 .maintenance 的文件 刪除它 ``` https://v123.tw/briefly-unavailable-for-scheduled-maintenance-check-back-in-a-minute/ ### 手動更新 **更新前都必須嚴格執行備份檔案及資料庫,一樣為避免不可預期的狀況發生可以馬上還原。** * 下載最新版本的 WordPress * 打開壓縮包 * 除了 wp-content 外,其他全都檔案及目錄直接覆蓋至您網站的根目錄。 特別要注意 wp-content 這個目錄,這個目錄用來儲存網站的資料用,請不要上傳新檔案覆蓋到這個目錄以免遺失網站的資料, https://v123.tw/wordpress-update-failed ## 推薦外掛 ### CSS & Javascript Toolbox 使用以後可以把css、js嵌入到頁面的head或footer的地方,而且這些css和js可以編完後重複使用,任意挑選頁面塞進去 這張圖是編輯介面,可以在這裡編寫css或js  這邊是在頁面上呈現的結果,我是選擇讓code區塊在Footer顯示(上一張圖可以看到有F的標記,若在開頭則是H)  原始code如下,可再進行延伸 ```=html <script> jQuery(document).ready(function($){ var div_value = $("#div_ID").text(); }); </script> ``` ###### tags: `js`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up