• Hi,

    I’d love the user’s favorite page to have more of a blog or portfolio look, but I’m a novice when it comes to php. Can anyone help me out with one or more of these? (and where to paste the code)

    Here’s what I’d like:

    1. No bullet list
    2. Thumbnail of post either above or to the left of the post title
    3. Show exerpt
    4. Two or three columns
    5. Buttons instead of plain links for add/remove

    …or maybe I should just look for a different plugin?

    https://www.ads-software.com/extend/plugins/wp-favorite-posts/

Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter solveigm

    (@solveigm)

    Solved most of this by editing the wpfp-page-template.php-file.
    This code does the following:
    – Removes bulleted lists
    – Shows post title as h2
    – Shows thumbnail to the left
    – Shows excerpt of post

    echo "";
        if ($favorite_post_ids):
    		$favorite_post_ids = array_reverse($favorite_post_ids);
            foreach ($favorite_post_ids as $post_id) {
                $p = get_post($post_id);
                echo "<div class='post'><div class='entry'>";
    						echo "<a href='".get_permalink($post_id)."'>";
    						echo get_the_post_thumbnail ( $post_id, 'thumbnail', array('class' => 'alignleft'));
    						echo "</a>";
    
                echo "<h3><a href='".get_permalink($post_id)."' title='". $p->post_title ."'>" . $p->post_title . "</a></h3> ";
                echo $p->post_excerpt;
                echo "<br><br>";
              	echo wpfp_remove_favorite_link($post_id);
              	echo "</div></div>";
                echo "<br>";
            }
        else:
            echo "";
            echo $wpfp_options['favorites_empty'];
            echo "<br><br>";
        endif;
        echo "";

    Also, I figured a way to display buttons instead of text links, but it requires that your theme has button shortcodes. I’m using Striking by Kaptlin Themes, and did the following in the settings page:

    – Select “No Image” as icon
    – Paste <div title="Add to favourites" class="button medium green"><span>Add to favourites</span></div> in “Text for add link”-field
    – Do the same for the other fields. My theme supports different color and size buttons.

    Additionally, I added a “Go to my favourites”-button next to add and remove, simply by pasting the following code after the </div> tag in the add/remove fields:
    <a href="your url" class="button medium white"><span>Go to my favourites</span></a>

    No all I need is to arrange the favourites in columns. Any suggestions?

    Hi solveigm
    Thank you so much for sharing the solution as I was looking for the exact answer for a few days now. The code you gave above for some reason dosen’t show the post excerpt do you know why? How do I show <?php the_excerpt(); ?> in the /wpfp-page-template.php?

    Thanks very much for your help
    Alex

    Hey qzha017,
    Unless you write something to the excerpt field in the post page nothing shows up. If you want to generate automatic excerpts there are more than enough plugins for that.

    @solveigm Thanks you so much for sharing your solution

    Thanks very much solveigm, your solution worked great!

    Hi solveigm, quick question, do you know if it’s possible to change the order the favorites are listed? Right now it lists the oldest to newest. Might be more trouble than it’s worth, but thought I’d ask ??

    Thread Starter solveigm

    (@solveigm)

    I would imagine you could change ‘array_reverse’ to just ‘array’ to list them new to old. See below where in my code I mean.

    Don’t take my word for it though, I’m still no expert! But as far as I can tell, you won’t do any harm by testing it.

    echo "";
        if ($favorite_post_ids):
    		$favorite_post_ids = array_reverse($favorite_post_ids);

    Ok so taking out the reverse will return nothing. So from what I gathered regarding this command is that we’re basically telling the array as stated to reverse itself once we have it. All that we have to do it remove this line

    $favorite_post_ids = array_reverse($favorite_post_ids);

    And the list will then go from latest favorited ??

    Cheers!

    Oh btw if you wanted, you can add a simple count to your list by simply using

    <?php echo count($favorite_post_ids, COUNT_RECURSIVE);?>

    anyway to show post content instead of excerpt? using

    <?php echo apply_filters('the_content', $post->post_content); ?> instead of your echo $p->post_excerpt; but it doesnt show anything. any help is appreciated.

    Oh btw if you wanted, you can add a simple count to your list by simply using

    <?php echo count($favorite_post_ids, COUNT_RECURSIVE);?>

    this works great except it shows 1 post is added when there’s no posts added, in chrome anyway. for some reason, IE and FF work great. Noticed this on the cookie warning too – doesnt display in chrome only.

    I wish when you clicked “remove all” or whatever you have on your favorites page, that it would refresh the page and clear your favorites.

    BTW, I am using v 1.5.6 because 1.5.8 doesnt work for me.

    Thanks so much, solveigm for you code! thumbnails displaying as they should! ??

    Now one more dilemma – does anyone yet have a solution to having a column view as opposed to vertical list for favorite posts??

    Elektra3, im using a column layout but its built into my theme. I know I’ve seen many articles on creating such a layout.

    Tech4Eleven, are you able to point me into the right direction? I’m quite new at this and not sure how to incorporate solveigm solution with column layout…? would be forever grateful! ??
    Is it a matter of changing php or as simple as CSS?

    Tech4Eleven, I think I’ve found the solution using my theme’s inbuilt columns layout and modifying “post” div class ?? seems to be working!

    Thanks so much for your help and pointing me in the right direction! :)))

    cool.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Plugin: WP Favorite Posts] Thumbnail and exerpt in favorite page view / blog look’ is closed to new replies.