WordPress啟用類別置頂插件category-sticky-post後,
類別內若無文章,會出現無貼文可置頂訊息:
Trying to get property of non-object in /.../wp-content/plugins/category-sticky-post/class-category-sticky-post.php on line 200
解法如下: 在add_styles()方法,增加isset($post->ID) && 判別指令。
category-sticky-post/class-category-sticky-post.php
public function add_styles() {
global $post;
if( isset($post->ID) && is_archive() && '1' !== get_post_meta( $post->ID, 'category_sticky_post_border', true ) ) {
wp_enqueue_style( 'category-sticky-post', plugins_url( '/category-sticky-post/css/plugin.css' ) );
}
}
參考:
https://tommcfarlin.com/category-sticky-post-2-1-0-support-post-types/
Trying to get property of non-object in /.../class-category-sticky-post.php on line 200
訂閱:
張貼留言 (Atom)
Building a Lightweight Streamlit Client for Local Ollama LLM Interaction
Ollama 提供端點串接服務,可由程式管理及使用本地大語言模型(LLM, Large Language Model)。 以下程式碼展示如何以 Streamlit 套件,建立一個輕量級的網頁介面,供呼叫 本地端安裝的 Ollama 大語言模型。 Ollama 預設的服務...

沒有留言:
張貼留言