Support » Plugin: WP Favorite Posts » Custom post type

  • Hi, I’m using custom post type to create my posts and the plugin dosn’t work. I can see add to favorites button on the post page; I can klick to add it and I get a message that the post is my favorite one but when I go to the page that should show the favorites post list there is nothing to show. I was trying with a regular post and everything is working. How do I do if I want be able safe my custom post as favorites?

Viewing 15 replies - 1 through 15 (of 20 total)
  • Maxj, this, unfortunately, won’t help you, but I am experiencing the same problem.

    However… it definitely used to work on Custom Post Types… I built a whole directory around the idea of users being able to “favorite” directory listings for later reading. So I really need to get it working again!

    Thread Starter maxj


    Lifesgod, I found a different solution:
    It is almost perfect but You can not use it if users are not logged in. I hope It can help You.

    Thanks so much Maxj – I’ll check it out. Curious… I’ve just discovered the plugin no longer also works on pages. Does that happen for you also?

    I have rolled back to 1.5.6 and it works again…

    Thanks lifesgood!

    Is this really the only way for custom post types to work? Is there any difference in the code somewhere?

    I made it work with my custom post type by going into wpfp-page-template.php and replacing

    query_posts(array('post__in' => $favorite_post_ids, 'posts_per_page'=> $post_per_page, 'orderby' => 'post__in', 'paged' => $page));
    while ( have_posts() ) : the_post();
       echo "<li><a href='".get_permalink()."' title='". get_the_title() ."'>" . get_the_title() . "</a> ";
       echo "</li>";


    foreach ($favorite_post_ids as $post_id) {
        $p = get_post($post_id);
        echo "<li>";
        echo "<a href='".get_permalink($post_id)."' title='". $p->post_title ."'>" . $p->post_title . "</a> ";
        echo "</li>";

    Hope that helps someone.

    Thread Starter maxj


    alexsean I own You!

    Alexsean, this fixed it for me too! I’m using a custom post type and I could click to favorite but it would never add it to my list page. I could even favorite a post on the post single page and it wouldnt list it. your code fixd both my issues!!!!

    thank you so much.

    Thanks Alex – this worked for me too!

    @alexsean, are you using v1.5.8 with this code? I’m using v1.5.6 with this code and it works but wondering if I can upgrade the latest version. Do your posts clear out of the favorites page when clicked? Mine dont- i have to manually refresh the page to get them to clear out.

    We have v 1.5.8 installed. Clicking the remove song or the clear list links clears the songs and refreshes without the songs displayed.

    ok thanks. my page template’s ajax still doesnt work even with 1.5.8 but i’ll keep looking.

    alexsean, your fix worked perfectly on custom post types.

    <Does the “88 miles per hour” dance>

    Thank you!



    I just wrote my own page template which seems to work well, so through I’d share… You can use the function to get the favourite ids out and write your own loop query…

    if ( function_exists('wpfp_get_users_favorites') ) $fp_ids = wpfp_get_users_favorites(); to get the IDs and writing your own query…

    Here’s an example:

    if ( function_exists('wpfp_get_users_favorites') ) $fp_ids = wpfp_get_users_favorites();
    query_posts(array('post_type' => 'your-post-type', 'post__in' => $fp_ids, 'orderby' => 'post__in'));
    if ( have_posts() ) :
    	while ( have_posts() ) : the_post(); ?>
    	<div class="post-item"><a href="<?php the_permalink(); ?>">
    	<?php the_post_thumbnail(); ?><?php the_title(); ?></a>
    	<?php wpfp_remove_favorite_link( get_the_ID() ); ?>
    <?php endwhile; // end of the loop.

    This way you can display the list of favourites anyway you like…

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Custom post type’ is closed to new replies.