[WordPress] 外掛分享: WPR General Posts

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

前言介紹

  • 這款 WordPress 外掛「WPR General Posts」是 2014-12-15 上架。
  • 目前有 10 個安裝啟用數。
  • 上一次更新是 2018-04-09,距離現在已有 2581 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 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;}
此過濾器位於打印

  • 的循環中。 $thisprint 是包含所有 HTML 的最終字符串,包括
  • 的開頭和結尾標籤。此過濾器可能是最常用的之一。 默認情況下,它會輸出特色圖像(如果存在)和標題。進行編輯循環的輸出,您需要將 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。它還包括開放的
      標籤。 $closeprint 包含所有 $openprint 的關閉標籤以及閱讀更多鏈接/文本。 $toprint 中包含要打印的列表
    • 構造。 $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 |

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

        • Post Slider and Post Carousel with Post Vertical Scrolling Widget – A Responsive Post Slider 》在您的 WordPress 網站上展示文章幻燈片或文章輪播。, 文章幻燈片和文章輪播具有 2 個短代碼,每個短代碼有 2 個設計和一個垂直文章捲動小工具。, 查看免費演...。
        • Post slider elementor addons 》Post Slider Elementor Addons 是一個非常漂亮的滑塊,用於顯示最新文章。它非常易於使用且完全動態。這是一個 Elementor 外掛程式,因此您需要首先安裝 Elem...。
        • Post List Designer by Category – List Category Post Or Recent Post 》✅ 文章列表設計師適用於:, , 使用美麗的設計顯示文章列表(2 種設計)。, 以簡單/極簡設計顯示文章列表。, 以儲存庫設計顯示文章列表。, 按類別顯示文章列表。...。
        • Recent Posts Widget Plus 》「Recent Posts Widget Plus」外掛允許您顯示所有或特定類別或標籤的最新文章清單。它不僅會顯示文章標題,還會顯示標題摘要。。
        • Better Recent Posts Widget (with thumbnails) 》重要提示:支援已移至 ZATZLabs 網站,不再提供於 WordPress.org 論壇。如果您需要開發人員的及時回覆,請 提交一個問題單。, 如果你曾經想要顯示最新文章,...。
        • Blogroll Widget with RSS Feeds 》這個 WordPress 小工具允許您以側邊欄小工具的形式通過 RSS 饋送顯示您的博客連結的最新文章。, 該外掛在不使用 Javascript 和 AJAX 的情況下運作。它使用 Wo...。
        • Smart Recent Post 》此外掛包含一個小工具,可展示最近的WordPress博客文章。, 有了這個外掛,您可以選擇要顯示的文章數量、顯示特色圖像、特色圖像的尺寸、文章的顯示順序,也可...。
        • Post Thumbnail & Post List 》文章縮圖和文章列表外掛能夠幫助您以縮圖和列表樣式顯示您最近發佈的 WordPress 文章。您可以按獨立類別顯示文章。不需要編程,支援行動裝置,快速執行。您可...。
        • Recent Post for Custom Post Type 》想要使用「最新文章」小工具,但是又想要套用自訂文章型別嗎?, 別擔心,這個外掛將使您可以輕鬆地建立自訂文章型別的「最新文章」小工具。。
        • Bake Posts 》Bake post是一個 WordPress 外掛,可以透過貼上對應的shortcode在頁面或小工具區顯示文章。它提供了顯示最新文章、依照分類和標籤顯示文章的簡碼。它還可以將...。
        • WS Recent Posts Widget 》這個外掛提供一個簡單的方式來顯示你的網誌最近的文章。, 功能, , 快速安裝和整合, 支援文章縮圖, 支援自訂分類法, 支援排序、位移和順序, 支援發佈日期和作...。
        • Recent Post Scroll Widget 》最新文章滾動小工具是一個高度可自定義的文章小工具。有許多選項可以顯示您的最新文章。, 以下是有些選項列表, 一般選項, , 標題, 標題圖示, 查詢文章數量:,...。
        • Recent Related Post And Page 》最近相關的文章和頁面外掛可以以美麗的設計和版面顯示文章和頁面。此外掛提供兩種選擇以顯示文章和頁面內容,可在您的WordPress網站上使用簡碼及小工具。, 這...。
        • Latest Tabs 》使用 jQuery 分頁標籤,可在側邊欄小工具中取得包含文章縮圖或頭像圖片的最新、熱門和最近評論列表。, 即時預覽:http://pluginspoint.com, 外掛功能:, , 縮...。
        • Extended Blogroll 》這個 WordPress 小工具允許您通過 RSS 鏈接顯示您的網誌連結的最近文章,作為側邊欄小工具或通過短碼 [blogroll] 顯示在任何文章或文章中的任何位...。

  • 文章
    Filter
    Apply Filters
    Mastodon