WordPress Plugin: My favorite posts

“My favorite posts”
is a WordPress plugin which allows logged in users to add posts they like to a private favorite post list.

This post will teach you how to use the plugin.

Current Version: 1.2
Last Update: October 10th 2008


First of all you need do download the zip file, unzip it and place the fav_me.php file at your server at /wp-content/plugins/.

Last Update: October 10th 2008, Version: 1.2


Installation is rather easy: just activate the plugin, it will create the database table it needs to work on its own.

Using the Plugin

We leave the no-brainer part to learn something interesting now: how to implement the plugin in your theme.
Basically all you need are 2 functions:

  1. mfp_the_link();
  2. mfp_display();

mfp_the_link will display an “Add this post to your favorite post list” link wherever you call it. Best practice of course is to add the function anywhere INSIDE your WordPress loop. That will create the add link for each post.

You can pass up to two parameters when calling mfp_the_link().
These are: add_link and remove_link.
The syntax is euqal to many wordpress core functions:

mfp_the_link("add_link=add me please&remove_link=remove me please");

This will replace the default link names with the ones you provide. If you want you can add markup as well:

mfp_the_link("add_link=<span class='add_this'>add me please</span>");

mfp_display will display the list of favorite posts anywhere you like. No WordPress loop required here.
So you can put the list in your sidebar, footer, main content area etc.

Of course you can pass parameters here as well. Calling the function without parameters will create an unordered list: each list item will contain a link to the post and a “remove link”.
The default classes added are:

  • ul class: mfp_favorites
  • link class: mfp_link
  • remove link class: mfp_remove_link

So you don’t like my classes? Or you want to display the items in <div> and <p> instead of <ul> and <li>?
Here are the parameters you may change:

  • title : Default is no title
  • display : Default is “list” -> you may change it to “div”
  • remove_link : Text for remove link, Default is “remove”
  • class : Class for ul/div , defaul is “mfp_favorites”
  • link_class : Class for the post link, default is “mfp_link”
  • remove_link_class : Class for remove link, default is “mfp_remove_link”
  • order_by : Order of items, default is ID, you can change that to any field name of the wp_posts table: some examples would be “post_title”, “post_author”, “post_date”. Get the full list at the WordPress Codex.

Some examples:

// Add a h3 title
mfp_display("title=<h3>Favorite Posts</h3>")

// Display as Div with different class names

// Order by post Title & different remove link text
mfp_display("order_by=post_title&remove_link=up up and away");

Another option is to pass the ID of a user to the function. This way it will display another users favorite post list. you can do that by apending the ID as a seperate parameter. The following example would retrieve the posts of user 13 from the database:


One of the best options to use this function would be to show it on the authors page of a user. Just insert the ID of the user dynamically ;)

Another option to display the posts is through the widget added in version 1.2.

Thats it. If you encounter any problems, please tell me via contact form or comments. I would also be glad to hear suggestions for improvements, be it in functionality, usability or code wise.

Have a nice day ;)

Version History:

v.1.0: 03.06.2008
v.1.1: 04.06.2008 (major code change, increased flexibility)
v.1.1.1: 10.06.2008 (minor bug fix: broken <a/> tag & php notice)
v.1.2: 10.08.2008 (added widget support and possibility to display other peoples favorite posts)


This WordPress Theme was discontinued and is no longer available for sale

Tags: ,
165 replies
« Older CommentsNewer Comments »
  1. Bekalius
    Bekalius says:

    hello Kriesi,
    nice plugin, i use this plugin, but must be more good.

    add in new version funcion of ajax, that will add post to favorite via ajax.

  2. eyeAmon
    eyeAmon says:

    Hi I like the plugin! it is awesome. I am trying to alter it to make it display the posts instead of just the title any ideas I am trying to query_posts(array(‘post__in’=>array($data))); but it only shows the first post… please help if you have any ideas there may be others who may benefit from this feature

  3. Newcos
    Newcos says:

    Is possible an user to share the list of favorite with other users?
    For example, a member to leave public the access its list of favorite?
    So this others can see and to be interested also in those posts.


  4. Valerie Wininger
    Valerie Wininger says:

    Hey! I love your plugin–thanks so much for your work on this! I have one question–is there a way to still show the ‘Add this post to your favorite post list’ link, even if the user isn’t logged in, but instead of adding it as a fave, it would link to a login page? I appreciate any help you can give. Thanks!

  5. Mobeego
    Mobeego says:

    @Valerie W.

    You can add it to an if statement in wordpress:

    <?php if (is_user_logged_in()){
    else {
    echo "Favorite";

  6. Mitko Yanakiev
    Mitko Yanakiev says:

    Hello, can somebody help me to make the same effect as http://foodgawker.com/. I mean i have to know how to make new page and there to input this plugin to show me the Fauvorited posts ( With picture and title ).
    I will be very thankful. :)

  7. Best WordPress Template
    Best WordPress Template says:

    Of course, that should be in another add & display functions?

    The add “Favorite Author” function will probably be placed on the “Author Page” :D.

    And the display “My Favorite Authors” will probably be sitewide (most probably on the “Profile/Author/User Page” :).

  8. Valerie Wininger
    Valerie Wininger says:

    @Mobeego — Thanks for the help! I got through that issue successfully.

    Now, I’m trying to customize the plugin a bit more, and have it show my post thumbnail instead of just a link to the post. The thumbnail is in a custom field, so I was trying to pull it using get_post_meta(), but that doesn’t appear to be pulling anything. I have the mfp_display() function inside the WordPress Loop on my page, and I’m not getting anything. Can anyone suggest a solution?


  9. Mobeego
    Mobeego says:

    @Valerie Wininger – that’s an interesting idea… I too have a post image in a custom field. I’ll post here if I get anywhere on it.

  10. Jordan Wollman
    Jordan Wollman says:

    Hey Kriesi, thanks for the plugin. It’s really, really nice and simple.

    Question though. Can you pull any more data from the db? I’d like to add the post itself to the favorites, not just a link with the title.

    Any help would be greatly appreciated!


  11. Carlisle
    Carlisle says:

    Plugin works perfect but I have a question. Many blogs have various categories like videos, jokes, tech etc. When I add a few post to my favorite lists, I can’t know which category the post belong. Is there a way to publish the name of the category that post belong?

  12. Alan
    Alan says:

    Hi is it possible to display the posts which have been made favourites by the most people.

    ie. most favourited

  13. Andy
    Andy says:

    Thanks for this plugin it is great!

    I am currently running it on a new site that is running on WordPress MU 2.7.1 and BuddyPress 1.0.1 and it works with no issues.

  14. Jen
    Jen says:

    Quick question. What if you want to display the favorites in a sidebar but the subscriber hasn’t “favorited” anything? Is there any way to show a message like “You don’t currently have any favorites?”

    That would be so helpful so you don’t have an header just sitting there with nothing under it.

  15. Dawid
    Dawid says:

    I use your plugin. It’s grate. I need put thumb on favorite list. Has anyone now haw to do it ?

  16. Jordan
    Jordan says:

    Does anyone know how I can create a functionality to either export the contents of the favorites widget or export the contents to an xls file? Thanks!

  17. Hein
    Hein says:


    Nice plugin,

    I wanted to use it with your theme i bought from themeforest “Design Showcase” , when i activate the plugin i get an error.

    Fatal error: Cannot redeclare mfp_install() (previously declared in /home/vhosting/10/tuttoaster.com/www/wp-content/themes/design_showcase/functions.php:515) in /home/vhosting/10/tuttoaster.com/www/wp-content/plugins/fav_me.php on line 61

    Please come with a solution, or an update

    Kind Regards,

  18. Robert
    Robert says:


    Is there a way to take a user’s favorite posts and pass the information to cforms? I’d like to allow users (logged in or anon) to favorite posts, and then send them on to the admin.


  19. John
    John says:

    Fantastic little plugin. Just getting to grips with it now. In answer to Dawid’s Q about adding a thumb – I’d suggest adding a background image to the css of the .add_this class – something like
    background: url(../yourimage.gif) no-repeat left center; padding-left:30px;

  20. anthony
    anthony says:

    Great Plugin! Got it working just fine. How difficult would it be to query the post text to display under the title. I created a “favorites” page, and just want to have the post excerpt to go along with the title..

    Thanks for the great plugin!

  21. FreeTools
    FreeTools says:

    Above all, I wanted to thank you for your ” plug in my favorite posts “.
    For personal needs, I added a small function which allows to show the favorite posts in the backoffice and add USERS submenu.

    I send you my solution which need to be improved.

    # ———————————-
    # Free Tools – 11/03/2009
    # ———————————-
    # Add Back Office Users Sub Menu
    # ———————————-
    add_action(‘admin_menu’, ‘mfp_users_submenu’);

    function mfp_users_submenu() {
    add_submenu_page(‘users.php’,’Favorite’, ‘Articles Favoris’, 0, __FILE__,’mfp_users_option’);
    # ———————————-
    } # end Menu Back Office
    # ———————————-

    # ———————————-
    # display favorite posts in back office
    # ———————————-
    function mfp_users_option() {

    // Add a h3 title, Order by post Title & different remove link text
    mfp_display(“title=Articles Favoris &order_by=post_title&remove_link= / retirer des favoris”);
    # ———————————-
    } # end display favorite posts in back office
    # ———————————-
    # End Free Tools
    # ———————————-

    thank again for your plug in


Trackbacks & Pingbacks

  1. […] View original post here: WordPress Plugin: My favorite posts | Kriesi.at – new media design […]

  2. […] WordPress Plugin: My favorite posts | Kriesi.at – new media design […]

« Older CommentsNewer Comments »

Comments are closed.