[WordPress] 外掛分享: WPR General Posts

WordPress 外掛 WPR General Posts 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「WPR General Posts」是 2014-12-15 上架。
  • 目前有 10 個安裝啟用數。
  • 上一次更新是 2018-04-09,距離現在已有 2879 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.0.1 以上版本才可以安裝。
  • 有 1 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

dunar21 |

外掛標籤

recent post | posts-widget | recent posts | popular posts | recent posts widget |

內容簡介

p>使用常規文章小工具,您可以根據 WP_QUERY 中提供的任何查詢參數將文章列表放置在小工具區域中。 您可以生成最新文章、熱門文章(如果您有跟踪文章點擊率的方法)、文章類型、按類別或其他分類方式過濾、按文章元過濾,等等... 如果它在 WP_QUERY 中可用,則在小工具中也可以使用。 如果介面沒有允許的定制,則有許多鉤子可以讓您編輯並控制小工具的幾乎所有部分,從調整查詢到調整輸出。

請注意

此外掛沒有與之關聯的樣式。 如果您想要樣式化輸出,請為小工具分配一個類和/或 ID,在您的 style.css 文件中適當地進行樣式化。

可用的鉤子

add_filter('widget_title', 'my_Func'); function my_Func($title){return $title;}
add_filter('wpr_adjust_genposts_query','my_Func', 10, 3); function my_Func($queryargs, $widgetargs, $instance){return $queryargs}
$widgetargs 包含像 before_widget 和 after_widget 這樣的東西。 $instance 包含您在 UI 中添加的小工具參數。
add_filter('wpr_genposts_titlefilter', 'my_Func', 10, 6); function my_Func($fintitle, $before_title, $title, $after_title, $instance){return $fintitle}
add_filter('wpr_genposts_listloop', 'my_Func', 10, 5); function my_Func($thisprint, $found_posts, $post, $count, $instance){return $thisprint;}
此過濾器位於打印 <li> 的循環中。 $thisprint 是包含所有 HTML 的最終字符串,包括 <li> 的開頭和結尾標籤。此過濾器可能是最常用的之一。 默認情況下,它會輸出特色圖像(如果存在)和標題。進行編輯循環的輸出,您需要將 my_Func 函數編輯為其他內容,利用包含所有文章信息(標題、摘要、內容、永久連結等)的 $post 變量進行自定義。這取決於您要如何自定義。 我相信支持區域將充滿關於以特定方式輸出列表的問題。大多數人不會讀或理解我在這裡寫的內容,許多示例可能會在支持部分迅速出現,因此請保持關注,閱讀這些內容(除非您是第一個尋求支持的人) 然後再發布支持問題。此外掛是免費的,不應期望支持。 我將在以後提供一般的支持許可證,用於所有 WPR 外掛,但目前不要期望,但如果我回答了,請感激。 我通常處理得很好。
add_filter('wpr_genposts_addtoend', 'my_Func', 10, 2); function my_Func($readingon, $instance){return $readingon;}
此過濾器允許您自定義在顯示所有文章之後顯示的“閱讀更多”鏈接。 最終文本/ HTML 是 $readingon 變量,$instance 為您在小工具界面上提供的所有小工具實例參數。
add_filter('wpr_genposts_list_print', 'my_Func', 10, 6); function my_Func($finalprint, $openprint, $toprint, $closeprint, $instance, $wpQuery){return $finalprint;}
這提供了包含容器 div 和其他所有內容的最終列表。 $openprint 包含小工具界面提供的 ID 和類別的開頭 div。它還包括開放的 <ul> 標籤。 $closeprint 包含所有 $openprint 的關閉標籤以及閱讀更多鏈接/文本。 $toprint 中包含要打印的列表 <li> 構造。 $wpQuery 包含整個查詢。

原文外掛簡介

With the general posts widget, you can place a list of posts into your widget areas based on any query parameters available in WP_QUERY. You can generate the latest posts, popular posts (given you have some method of tracking post hits), post types, filter by category or other taxonomy, filter by post meta, etc… If it’s available in WP_QUERY it’s available to you in the widget. If there are customizations that the interface does not allow for, there are a number of hooks that allow you to edit and control pretty much any part of the widget from adjusting the query to adjusting the output.
Please Note
There is no styling associated with this plugin. If you wish to style the output, assign a class and/or an ID to the widget and style appropriately in your style.css file.

Available Hooks

add_filter( 'widget_title', 'my_Func'); function my_Func($title){return $title;}
add_filter('wpr_adjust_genposts_query','my_Func', 10, 3); function my_Func( $queryargs, $widgetargs, $instance){return $queryargs}
$widgetargs contains things like before_widget and after_widget. $instance contains the widget params you added in the UI.
add_filter('wpr_genposts_titlefilter', 'my_Func', 10, 6); function my_Func($fintitle, $before_title, $title, $after_title, $instance){return $fintitle}
add_filter(‘wpr_genposts_listloop’, ‘my_Func’, 10, 5); function my_Func($thisprint, $found_posts, $post, $count, $instance){return $thisprint;}
This filter is within the loop that prints the

  • 's. $thisprint is the final string containing all the html including the
  • opening and closing tags. This filter will likely be the one used the most. By default, this outputs the featured image (if one exists) and the title. That’s all. In order to edit the output of the loop, you would want to edit your my_Func function to something else, utilizing the $post variable which contains all the post information (title, excerpt, content, permalink, ect…). This is up to you to customize however you wish. I’m sure the support area will fill up with questions in regards to outputting the lists in a certain fashion. Most people will not read or understand this that I wrote here and many examples will likely sprout up in the support section, so stay tuned and read through those (unless you are the very first to ask for support) before posting a support question. This plugin is free and support should not be expected. I will have a general support license available at a later time, for all WPR plugins, but for now, don’t expect, but be grateful if I do answer. I’m usually good about it though.
    add_filter('wpr_genposts_addtoend', 'my_Func', 10, 2); function my_Func($readingon, $instance){return $readingon;}
    This filter allows you to customize the read more link that is shown after all the posts are displayed. The final text/html is the $readingon variable and the $instance provides you with all the widget instance params you supplied in the widget interface.
    add_filter('wpr_genposts_list_print', 'my_Func', 10, 6); function my_Func($finalprint, $openprint, $toprint, $closeprint, $instance, $wpQuery){return $finalprint;}
    This supplies the final list with the container divs and everything else. $openprint contains the opening div with the id and class supplied by the widget interface. It also includes the openieng

      tag. $closeprint contains all the closure tags for the $openprint as well as the readmore link/text. $toprint contains everything in between (the result of the query contained in

    • tags). $wpQuery contains the WP_Query instance, which can be used for pagination or anything else where the data provided could be useful. To add pagination, something like this would work:
      function homeAddPages($finalprint, $openprint, $toprint, $closeprint, $instance, $postsQ){
      $big = 999999999;
      $cpage = get_query_var('paged')?get_query_var('paged'):0;
      if(!isset($cpage) || $cpage == "" || $cpage === 0){
      $cpage = get_query_var('page')?get_query_var('page'):1;
      }
      $addclose = paginate_links( array(
      'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
      'format' => '?paged=%#%',
      'current' => max( 1, $cpage),
      'total' => $postsQ->max_num_pages
      ) );
      return $openprint . $toprint . $closeprint . '

      ' . $addclose . '

      ';
      }
      add_filter('wpr_genposts_list_print', 'homeAddPages', 10, 6);
      add_filter('wpr_adjust_genposts_beforewidget', 'my_Func', 10, 3); function my_Func($before_widget, $post_widgeid, $post_widgeclass){return $before_widget;}
      This allows you to modify the before widget string which contains the wrapper div with id and class. You have access to the ID and Class you defined within the widget in order to tell instances apart from each other.
      unction wpr_changeBeforeWidget($before_widget, $post_widgeid, $post_widgeclass){
      if($post_widgeid == 'theothers'){
      return str_replace('class="', 'class="theothersblock ', $before_widget);
      }
      if($post_widgeid == 'thefeatured'){
      return str_replace('class="', 'class="thefeaturedblock ', $before_widget);
      }
      return $before_widget;
      }
      add_filter('wpr_adjust_genposts_beforewidget', 'wpr_changeBeforeWidget', 10, 3);
      add_filter('wpr_adjust_genposts_afterwidget', 'my_Func', 10, 3); function my_Func($after_widget, $post_widgeid, $post_widgeclass){return $after_widget;}
      This is identical to the wpr_adjust_genposts_beforewidget hook except this one allows you to modify the after widget string. These last two allow you direct control over each individual widget container. These before and after strings are set in the register_sidebar function when creating the sidebars, but they are generic for all widgets in that sidebar and WP does not offer any hooks to modify this directly. There is a workaround to add the action for register_sidebar, get the sidebar object and then adjust the $wp_registered_sidebars global, but in order to do this, you would have to know the order id number of the specific widget. Doing it that way can be problematic.

      Instance Variables

      $title = apply_filters( 'widget_title', $instance['title'] );
      $post_amount = $instance['show']; This is the posts per page (total posts to show)
      $post_orderby = $instance['orderby'];
      $post_order = $instance['order'];
      $post_catin = $instance['catin']; Category In
      $post_catout = $instance['catout']; Category Exclude
      $pagecount = $instance['pagecount']; Numer of Posts to show (not used, this is so you can define total posts to query and number to show per tabbed interface which is not implemented in the plugin, but available for hooking)
      $post_taxis = $instance['taxis']; Taxonamy slug
      $post_taxterm = $instance['taxterm']; Taxonomy term ids, comma separated list
      $post_typed = $instance['ptipe'];
      $post_metakey = $instance['metakey'];
      $post_metavalue = $instance['metavalue'];
      $post_comparison = $instance['metacompare']; Meta comparison operator
      $post_widgeid = $instance['widgetidentifier']; Widget Container ID
      $post_widgeclass = $instance['widgetclassifier']; Widget Container Class
      $post_readmoretitle = $instance['readmoretitle'];
      $post_readmorelink = $instance['readmorelink'];

      Plugin site: WorldpressRevolution

      各版本下載點

      • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
      • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「WPR General Posts」來進行安裝。

      (建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


      1.0.0 | 1.1.0 | 1.2.0 |

      延伸相關外掛(你可能也想知道)

      • Recent Posts Widget Extended 》外掛描述, 此外掛可以啟用自定義、靈活且進階的最新文章功能,您可以透過簡碼或小工具來顯示它。您可以顯示具有縮略圖、摘要和發佈日期的最新文章清單,並且...。
      • WebberZone Top 10 — Popular Posts 》WordPress 沒有內建的系統可以追蹤網頁瀏覽量或顯示熱門文章。 Top 10 是一個易於使用、功能強大的 WordPress 外掛程式,可以計算您的文章、頁面和任何自訂文...。
      • Smart Post Show – Post Grid, Post Carousel & Slider, and List Category Posts 》, 實時演示 | 升級到專業版! | 支援, Smart Post Show(前稱Post Carousel)讓您輕鬆過濾和顯示文章、頁面、分類(類別、標籤和文章格式)的美麗旋轉木馬和...。
      • Smart Recent Posts Widget 》由於 WordPress 5.8 更新 Widget 功能,如果要使用此外掛程式,您必須使用 WordPress 5.8.x。, Smart Recent Posts Widget 提供彈性且高度自訂的最新文章小工...。
      • Statify Widget 》Statify Widget 顯示由 pluginkollektiv 製作的 Statify WordPress 外掛中最受歡迎的內容。快速且清晰明瞭!, 什麼是 Statify?, Statify 是一個訪客統計外掛...。
      • WP Views Counter 》此外掛可以記錄每個文章、頁面或自訂文章類型的瀏覽次數,並直接在 WordPress 清單上查看。, 您可以在插件設定中選擇要計數的文章類型,也可以使用短碼 [WPeC...。
      • WP Most Popular 》WP Most Popular 是一個應付排名部落格上最熱門文章的簡單任務的插件,創建的原因是因為找不到一個好的插件而感到沮喪。, 此插件根據瀏覽量記錄了您最受歡迎...。
      • Light Views Counter – Fast, Scalable View Counter for High-Traffic Sites 》總結:Light Views Counter 是一個專業、高效能的 WordPress 外掛,透過智能滾動偵測追蹤文章瀏覽次數。特別設計給高流量網站和大型資料庫使用,可提供可靠的...。
      • YAHMAN Add-ons 》網頁瀏覽次數、Google AdSense、Analytics、社群媒體、個人檔案、目錄表、相關文章、網站地圖、SEO、JSON-LD 結構化資料、Open Graph 協定(OGP)、部落格卡...。
      • Popular Posts 》Popular Posts 外掛能夠顯示您部落格中最瀏覽的文章的列表。您可以在許多方面自訂輸出。, 此外掛需要最新版本的 Post-Plugin Library:立即下載。, 版本歷史,...。
      • Popular Posts by Webline 》Popular Posts將根據管理員端應用的篩選器列出所有帖子。, 主要特點, , 集中的插件功能開啟/關閉選項。, 通過應用可用的篩選器顯示帖子,例如按評論排序或按...。
      • Most And Least Read Posts Widget 》「最受歡迎與最不受歡迎文章小工具」是一款 WordPress 的免費外掛,由 Giuliano Polverari (WhileTrue.it) 開發,可生成最受歡迎和最不受歡迎文章的清單。, ...。
      • Random Posts and Pages Widget 》WordPress 隨機文章和頁面, , WordPress 隨機文章外掛價格, 隨機文章免費演示, 隨機文章專業版演示, , Ays 隨機文章/頁面小工具是用於網站內部鏈接的創建。, ...。
      • Relevant – Related, Featured, Latest, and Popular Posts by BestWebSoft 》Relevant 外掛可以在你的 WordPress 網站上顯示相關、最新、熱門和精選文章。你可以自訂小工具、變更外觀、熱門文章數量,以及更多。, 突顯並顯示適當的資訊...。
      • Popular Post Widget 》這是一個像其他小工具一樣的簡單小工具,根據您的文章觀看次數顯示您最受歡迎的文章。從 WordPress 儀表板將其放置在任何小工具區域中,它會自動顯示 5 篇最...。

  • 文章
    Filter
    Apply Filters
    Mastodon