
內容簡介
WP My Favourites 是一個簡單的 WordPress 外掛,它允許您從後台選擇最佳的文章、頁面、評論和媒體,並在需要時在您的網站中提取它們。它還允許您使用拖放方式按照您的意願重新排序您的最愛。
部分功能
AJAX 引擎的後台設定區域。
適合易管理的制表符界面。
用戶在後台可以透過提示框和幫助(?)圖示輕鬆理解。
通過點擊“讚”或“噓”圖示來選擇您的最愛。
通過拖放選擇的文章輕鬆重新排序。
不需要點擊保存按鈕等步驟。已選擇的項目被保存在數據庫中。
從後台的 WP My Favourites – 配置區域中按照自己的需要更改設置。
如何使用 - 後台
啟用插件後,您會在儀表板中看到 WP My Favourites 菜單項目。
在菜單名稱下,您會看到兩個子菜單:最愛的文章、最愛的評論、最愛的媒體。
點擊任何子菜單。假設您點擊了最愛的文章。
(注意:“最愛的文章”還讓您選擇頁面。)
您可以通過點擊“設置”部分更改最愛列表和選擇的設置。
在頂部,您會看到“默認選擇任何 15 篇文章”。15 可以在 wp-myfavourites/wp-myfavourites.php 文件中更改。
在“默認選擇任何 15 篇文章”旁邊的是幫助(?)圖示。將鼠標放在上面可以得到一些幫助信息。
第一個表格顯示所有的文章和頁面。您還可以在 wp-myfavourites/wp-myfavourites.php 文件中添加自定義文章類型。
要選擇文章,只需單擊代表未選記事項的黑色“讚”圖示。一旦您點擊黑色“讚”圖示,該文章將被添加到“最愛的文章”部分,並且黑色“讚”圖示將變成藍色。
您可以在第二個表格中看到已選文章。要重新排序文章,只需將第二個表格中的第一個單元格拖動到所需位置。
如果要刪除已選文章,只需單擊第一個表格中的藍色“讚”圖示或第二個表格中的藍色“噓”圖示。
對於“最愛的評論”和“最愛的媒體”部分,也適用相同的操作。
如何使用 - 前端
使用短碼來獲取列表
1. 以 HTML 格式獲取最愛的文章
[show-favourite-posts post_types='post,page' no_of_posts=-1 no_of_chars='20']
Shorcode 參數:
post_types:從後台選擇的文章類型的逗號分隔列表。
no_of_posts:指定要從所選文章中獲取的總文章數量。
no_of_chars:指定從帖子內容中獲取的字符數量。
2. 以 HTML 格式獲取最愛的評論
[show-favourite-comments no_of_comments=10 no_of_chars=20]
Shorcode 參數:
no_of_comments:指定要從所選評論中獲取的總評論數量。
no_of_chars:指定從評論內容中獲取的字符數量。
3. 以 HTML 格式獲取最愛的媒體
[show-favourite-media no_of_media=20 image_size=120,120]
Shorcode 參數:
no_of_media:指定要從所選媒體中獲取的總媒體數量。
i
外掛標籤
開發者團隊
原文外掛簡介
WP My Favourites is a simple plugin which allows you to select the best posts, pages, comments and media from backend and fetch them as and when needed in your website. It also allows you to reorder your favourite as per your wish using Drag and Drop.
Some of the features
AJAX-powered backend settings section.
Tabular UI for easy management.
Tooltips on hover and Help(?) icons in the backend for first time users.
Choose your best items simple by clicking the Thumbs Up/Thumbs Down icons.
Easily reorder by dragging and dropping the selected posts.
No need to click save button etc. Selected items are saved in database as the selects or reorder them.
Change the settings as per your need from the settings given in WP My Favourites – Configuration section in backend.
How to use – Backend
After activating the plugin you can see WP My Favourites menu item in the dashboard.
Under the menu name you can see two sub menus: Favourite posts, Favourite comments, Favourite media.
Click on any sub menu. Suppose you clicked on Favourite posts.
(Note: Favourite posts also lets you select pages also.)
You can change the settings for the listing and selection of favourites by clicking on the Settings section.
On top you will see Select any 15 posts by default. This 15 can be changed in the wp-myfavourites/wp-myfavourites.php file.
Adjacent to Select any 15 posts in Help(?) icon. Hover it to get some help.
The first table shows all the posts and pages. You can also add custom posts be adding the custom post type slug in const WP_MYFAVOURITES_POST_TYPE array in wp-myfavourites/wp-myfavourites.php file.
To select a post simple click on the Black Thumbs Up which represents un-selected post. Once you click on the Black Thumbs Up that post will be added to the Favourite post section and the Black Thumbs Up will turn into Blue.
You can see your selected posts in the second table. To reorder the posts simple Drag the first cell in the second table and Drop on the desired position.
If you want to remove a selected post then simple Click on the Blue Thumbs Up on the first table or click on the Blue Thumbs Down in the second table.
The same applies to the Favourite comment and Favourite Media section as well.
How to use – Frontend
Getting listing using shortcodes
1. Get favourite posts with HTML
[show-favourite-posts post_types='post,page' no_of_posts=-1 no_of_chars='20']
Shorcode arguments:
post_types: Comma separated list of post types to fetch from selected posts in backend.
no_of_posts: Number specifying the total number of posts to fetch from the selected posts.
no_of_chars: Number specifying the number of characters to get from the post’s content.
2. Get favourite comments with HTML
[show-favourite-comments no_of_comments=10 no_of_chars=20]
Shorcode arguments:
no_of_comments: Number specifying the total number of comments to fetch from the selected comments.
no_of_chars: Number specifying the number of characters to get from the comment’s content.
3. Get favourite media with HTML
[show-favourite-media no_of_media=20 image_size=120,120]
Shorcode arguments:
no_of_media: Number specifying the total number of media items to fetch from the selected media.
image_size: Comma separated width and height respectively of the image. Default is 20,20.
Getting WP_Post and WP_Comment Object
1. Get array favourite posts
Call
Method arguments:
$post_types: Array of post types to fetch from the selected posts
$number_of_posts: Number specifying the total number of posts to fetch from the selected posts.
2. Get array of favourite comments
Call
Method arguments:
$number_of_comments: Number specifying the total number of comments to fetch from the selected posts.
3. Get array of favourite media
Call
Method arguments:
$no_of_media: Number specifying the total number of media items to fetch from the selected media.
3. Getting array of selected ids
Method arguments:
$type: Accepts ‘posts’ or ‘comments’ or ‘media’ as parameters
$count: Number of ids to fetch
