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)
how to deal with metric scale inconsistency in topn recommendation evaluation
🎯 推薦系統一般會回傳前 N 個排名的物品清單給用戶,稱為 Top‑N 推薦。 遇到推薦模型須要訓練及評估時,習慣先蒐集用戶與物品的互動資料,再將資料拆分成沒有重疊的訓練集及測試集。 模型在訓練時只看得到訓練集,評估時則拿測試集作為驗證的標準答案,以免作...
沒有留言:
張貼留言