顯示具有 sticky post 標籤的文章。 顯示所有文章
顯示具有 sticky post 標籤的文章。 顯示所有文章

Trying to get property of non-object in /.../class-category-sticky-post.php on line 200

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/

Installing Code::Blocks on Windows for APCS Preparation

APCS 為大學程式設計先修檢測 (Advanced Placement Computer Science),其檢測等級可供大學個人申請入學時,比對是否符合各電腦相關科系APCS組申請資格之用。其中,針對 C 及 C++ 程式檢測者,考場提供 Linux 環境的輕量級 Code...

總網頁瀏覽量