內容簡介
bbP Topic Views 會追蹤每個 bbPress 主題被瀏覽的次數,然後在論壇頁面、主題存檔頁面、標籤頁面和檢視頁面的主題標題或元數據旁顯示計數。
插件的編寫方式不會在訪客瀏覽同一主題的不同頁面時重複計算視圖次數。如果特定主題沒有視圖計數記錄,插件將為其創建記錄。插件將初始視圖計數設置為該主題中的帖子數,而不是零,因為顯然該主題至少被瀏覽了與發表的帖子數相同的次數!這對於添加插件到現有的 bbPress 論壇非常方便,因為每個主題的視圖計數不是零。
插件還為您提供一些函數,您可以在模板中調用這些函數輸出主題視圖計數,還提供了一些短碼,您可以在文章中放置這些短碼以生成最多瀏覽的主題的主題表格(請參閱 其他說明)。你現在可能已經猜到了,這也有一個視圖。
本插件是 bbPress 獨立的 ck 和 wittmania 的 bb Topic Views 插件的分支。非常感謝他們!
短碼
[bbp-single-view id="btv-most-viewed"] 生成最多瀏覽的主題的主題表格。
函數調用
$bbp->shortcodes->display_view( array( 'id' => 'btv-most-viewed' ) ); 生成最多瀏覽的主題的主題表格。
btv_topic_view_count( $topic_id ) 或
btv_get_topic_view_count( $topic_id ) 輸出或檢索所提供主題 ID 的視圖計數(選擇性,如果沒有傳遞,則使用 bbp_get_topic_id() 函數猜測主題 ID)。
要將視圖計數列添加到主頁面、論壇頁面和/或標籤頁面表格中,請進行以下修改。注意:這些適用於默認的 bbPress (TwentyTen)主題。如果您使用不同的主題或高度修改的默認主題,您的修改可能略有不同。建議如果你在遵循這些步驟之前做你的主題的子主題,那麼當您升級 bbPress 或主題時,您的更改不會丟失。
到 管理區 -> 設置 -> 論壇 ->(向下滾動至)bbP 主題視圖,並勾選不自動添加選項。這將防止視圖計數自動添加到任何地方。
打開 your-theme-name/bbpress/loop-topics.php。在大約 17 行附近,您會發現:
將其替換為:
大約在第 71 行,您會發現:
替換為:
如果您想重新排列列的順序,可以進行更改,只需確保您依照每個部分的正確順序進行排列。
翻譯
意大利語由 Alex提供
捐贈
您可以通過這裡進行捐贈 here。
待辦事項
現在沒有。
外掛標籤
開發者團隊
原文外掛簡介
bbP Topic Views keeps track of how many times each bbPress topic has been viewed, and then displays the count alongside the title or meta of the topic on forums pages, topic archive pages, tag pages and view pages.
The plugin is written in such a way that it does not double-count views when a visitor browses to a different page in the same topic. If no view count record exists for a specific topic, the plugin will create a record for it. Rather than setting the initial view count to zero, the plugin sets it to the number of posts in the topic, because it has obviously been viewed at least as many times as people have posted in it! This is especially nice for adding the plugin to existing bbPress forums so the view count isn’t zero for every single topic.
The plugin also offers you some functions, which you can call in your template to output the topic view count and some shortcodes which you can place in your posts to generate a topic table for most viewed topics (see Other Notes). As you might have guessed till now, there is also a view for the same.
This plugin is a fork of ck and wittmania’s bb Topic Views plugin for bbPress standalone. Many thanks to them!
Shortcode
[bbp-single-view id="btv-most-viewed"] to generate a topic table for most viewed topics.
Function Calls
$bbp->shortcodes->display_view( array( 'id' => 'btv-most-viewed' ) ); to generate a topic table for most viewed topics.
btv_topic_view_count( $topic_id ) or
btv_get_topic_view_count( $topic_id ) to output or retrieve the view counts for the supplied topic id (optional, if not passed, it is guessed by using the bbp_get_topic_id() function).
To add a view count column to front page, forum, and/or tags page tables, make the following modifications. Note: these apply to the default bbPress (TwentyTen) theme. If you are using a different theme, or a highly modified version of the default, your modifications may be slightly different. It is recommended if you make a child theme of your theme before following these steps so that when you upgrade bbPress or your theme, your changes are not lost.
Go to Admin Section -> Settings -> Forums -> (scroll down to) bbP Topic Views and check the add nowhere option. This will prevent the view count from being added anywhere automatically.
Open your-theme-name/bbpress/loop-topics.php. Around line 17, you would find:
Replace it with:
Around line 71, you would find:
Replace it with:
You can rearrange the order of the columns if you’d like, just make sure you get them in the right order for each section.
Translations
Italian by Alex
Donate
You may donate by going here.
Todo
Nothing for now.
