WP My Favourites is a simple plugin which allows you to choose your best posts, pages, comments from backend and fetch the selected ids or as objects and use them as and when needed in your theme. It also allows you to reorder your best posts, pages or comments as per ypur wish using Drag and Drop feature in the backend.
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 heart 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 users works.
- Change the settings as per your need from the settings given in WP My Favourites Configuration section in wp-myfavourites/wp-myfavourites.php file.
Usage – 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 and Favourite comments.
- Click on any sub menu. Suppose you clicked on Favourite posts.
- On top you will see Select any 15 posts. This 15 is fetched from the
wp-myfavourites/wp-myfavourites.phpfile and you can change it as per your need.
- Adjacent to Select any 15 posts in Help(?) icon.
- Below the heading is the table which shows all the posts and pages. You can also add custom posts be adding the custom post type slug in
const WP_MYFAVOURITES_POST_TYPEarray in
- To select a post simple click on the Black heart which represents un-selected post. Once you click on the Black heart that will posts will be added to the Favourite post section and the Black heart will turn into Red.
- 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 Red heart on the first table or the second table.
- The same applies to the Favourite comment section as well.
- If you ever rename
WP_MYFAVOURITES_FAVOURITE_COMMENTS_OPTION_NAMEthen you have to first deactivate and then re-activate the plugin and you will lose your favourite items.
Usage – Frontend
<?php Wp_MyFavourites_Public::wp_mf_favourite_posts(array_of_post_types(optional), number_of_posts(optional) ) ?>to get the
WP_Post Objectof the selected favourite posts.
<?php Wp_MyFavourites_Public::wp_mf_favourite_comments() ?>to get the
WP_Comment Objectof the selected favourite comments.
- To simply get the Ids of selected posts/comments call
<?php Wp_MyFavourites_Public::wp_mf_get_favourite_ids('posts' or 'comments', number of ids to fetch) ?>