Support » Plugin: WP Favorite Posts » Show Favorites page in grid??

Viewing 15 replies - 1 through 15 (of 24 total)
  • You can do it very easily with CSS styling, e.g. for a ul list. Then just add the ul list class to the template file with the method you’re currently using.

    I’m using a 4 column grid style format here:
    http://www.classicgrand.com/gigs/

    All it is, is CSS and I’ve used the same format for the favourites page.

    For example, this is my code in the favorite posts wpfp-page-template.php

    http://pastebin.com/dAqKFX3X

    My list class is favorite_thumbnails.

    Hi ksaffy, thank you very much for your help.
    Really I don´t know programing very well.
    I am change the code of wpfp-page-template.php for your code and this is the result:
    Fatal error: Call to undefined function em_get_event() in /public_html/wp/wp-content/plugins/wp-favorite-posts/wpfp-page-template.php on line 3
    I need that favorites page show the same that my other pages.
    Can you help me a little more??

    OK, don’t copy this section

    <?php
    global $post;
    $EM_Event = em_get_event($post->ID, 'post_id');
    ?>

    As this is a global declaration for something that’s not related to favorite posts.

    So all you want is:

    <?php
    echo "<div class='wpfp-span'>";
        if (!empty($user)):
            if (!wpfp_is_user_favlist_public($user)):
                echo "$user's Favorite Posts.";
            else:
                echo "$user's list is not public.";
            endif;
        endif;
    
        if ($wpfp_before):
            echo "<p>".$wpfp_before."</p>";
        endif;
    
        echo "";
        echo "<div class='box'>";
       if ( is_user_logged_in() ) {
       global $current_user;
          get_currentuserinfo();
          echo '<h5 class="sub">Welcome ' . $current_user->display_name . "!</h5> ";
    } else {
        echo '<h5 class="sub">Welcome, visitor</h5>';
    }
        echo "Use this space as your own spot on example.com to save the gigs and events that matter most to you! Just click  <img src='http://www.example.com/heart.png' alt='favourite gigs' width='11'> add to my gigs on the event page of any gig you want to save.<br><br>Add as many as you like and make it your own! <br>";
     echo "</div>";
    
         if ($favorite_post_ids):
         $favorite_post_ids = array_reverse($favorite_post_ids);
    
            foreach ($favorite_post_ids as $post_id) {
                $EM_Event = em_get_event($post->ID, 'post_id');
                $p = get_post($post_id);
                $l = get_permalink($post_id);  
    
                echo "<ul id='favorite_thumbnails'><li>";
    
    echo "<a href='".get_permalink($post_id)."'>";
    echo get_the_post_thumbnail ( $post_id, '270x150');
    $EM_Event = em_get_event($post->ID, 'post_id');
    $d = date_i18n(get_option('dbem_date_format'), $EM_Event->start);
            echo "<br>";
    echo "<span><a href='".get_permalink($post_id)."' title='". $p->post_title ."'>" . $p->post_title . "</a></span>";
    wpfp_remove_favorite_link($post_id);
    
                     echo "</li></ul>";
                    echo "</a>";
            }
        else:
       endif;
        echo "";
    echo "<br class='clear'>";
        wpfp_clear_list_link();
    echo "</div>";
        wpfp_cookie_warning();
    ?>

    That should sort your fatal error. Then you need to get your styles sorted for ul list. Are you ok with CSS? I can offer you some advice on how to style your list if you want.

    Wow!!! Fast response!!
    Here my new results:
    Welcome admin!

    Use this space as your own spot on example.com to save the gigs and events that matter most to you! Just click add to my gigs on the event page of any gig you want to save.

    Add as many as you like and make it your own!

    Fatal error: Call to undefined function em_get_event() in /home/myzap815/public_html/wp/wp-content/plugins/wp-favorite-posts/wpfp-page-template.php on line 31

    Tanks ;D

    PD: I´m using “Pinboard” template.

    News:
    I was erase lines 31 and 38 and now work, but I see the list (left) and images (right).
    And my Categories section is a grid (4 colums).
    Can I see Favorites the same that Categories?

    Ah, yes sorry, everything EM related will throw out a fatal error for you. Remember to change the example.com to your own domain (I just used that as a placeholder domain for you). You’ll need to define your ul list css. Something like this should give you your grid style. You may want to change your thumbnail image size. I have defined thumbnails of 270×150 each time images are uploaded to my site and that’s the size I use for fav posts. You may want to use a different size.

    #favorite_thumbnails{list-style-type:none;list-style-position:inside;padding:0;margin:0}
    #favorite_thumbnails li{float:left;margin:0;padding-left:7px;padding-right:7px;padding-top:2px;padding-bottom: 2px;display:block;opacity:1}
    #favorite_thumbnails li a{border:0 none;line-height:normal;font-size-adjust:none;font-stretch:normal;clear:right}
    #favorite_thumbnails li a+a{position:relative;top:-50px;display:block;padding-left:10px;padding-top:5px;padding-bottom:0;padding-right:0;margin-left:0;width:auto;height:auto;background:#000!important;overflow:hidden;height:40px;color:#FFF!important;text-decoration:none;font:12px Arial;text-transform:uppercase;font-weight:800;opacity:.8}
    #favorite_thumbnails img{padding:2px;margin:0;border:0 none}
    #favorite_thumbnails img:hover{opacity:.3;transition:opacity .5s linear}

    Incredible!!! Your code work fine for me.
    Thank you for your patient and help me.
    Are you an expert programer??
    I´m working in a new proyect and is posible that I need colaborators.
    If you are interested we can contact us for email.

    Glad you got it working. I am an expert programmer and web designer, but I have too many projects ongoing at the moment to take any more on. Good luck with yours! 🙂

    Ok, nice to meet you and thanks for your help.
    If you are interested in other moment I can pay for your work.
    A greeting.

    thanks for the code – works great, but it takes the full size image…
    could i specify that it takes, say the “featured image” that each post has?

    thanks

    You need to check your theme for your thumbnails. The code

    echo get_the_post_thumbnail ( $post_id, '270x150');

    pulls the thumbnail of the featured image that I used in my theme called 270×150. Your own theme will not use the same, so you’ll need to define it. It’s most likely ‘thumbnail’. In which case you’d use:

    echo get_the_post_thumbnail ( $post_id, 'thumbnail');

    @ksaffy genius 🙂

    @ksaffy: It’s not working for me…I replaced your code completely in wpfp-page-template.php. i didn’t get any favourite post list.

    You don’t replace the above input code completely as this is for my theme and my associated plugins. You need to remove all references to EM and events. If you don’t know what you’re doing with php, you maybe shouldn’t tamper with it. Below is an edited script. Remember, this is for my thumbnail reference and also css code references that applies to my theme.

    <?php
    echo "<div class='wpfp-span'>";
        if (!empty($user)):
            if (!wpfp_is_user_favlist_public($user)):
                echo "$user's Favorite Posts.";
            else:
                echo "$user's list is not public.";
            endif;
        endif;
    
        if ($wpfp_before):
            echo "<p>".$wpfp_before."</p>";
        endif;
    
        echo "";
        echo "<div class='box'>";
       if ( is_user_logged_in() ) {
       global $current_user;
          get_currentuserinfo();
          echo '<h5 class="sub">Welcome ' . $current_user->display_name . "!</h5> ";
    } else {
        echo '<h5 class="sub">Welcome, visitor</h5>';
    }
        echo "Use this space as your own spot on example.com to save the gigs and events that matter most to you! Just click  <img src='http://www.example.com/heart.png' alt='favourite gigs' width='11'> add to my gigs on the event page of any gig you want to save.<br><br>Add as many as you like and make it your own! <br>";
     echo "</div>";
    
         if ($favorite_post_ids):
         $favorite_post_ids = array_reverse($favorite_post_ids);
    
            foreach ($favorite_post_ids as $post_id) {
                $p = get_post($post_id);
                $l = get_permalink($post_id);  
    
                echo "<ul id='favorite_thumbnails'><li>";
    
    echo "<a href='".get_permalink($post_id)."'>";
    echo get_the_post_thumbnail ( $post_id, '270x150');
    echo "<br>";
    echo "<span><a href='".get_permalink($post_id)."' title='". $p->post_title ."'>" . $p->post_title . "</a></span>";
    wpfp_remove_favorite_link($post_id);
    
                     echo "</li></ul>";
                    echo "</a>";
            }
        else:
       endif;
        echo "";
    echo "<br class='clear'>";
        wpfp_clear_list_link();
    echo "</div>";
        wpfp_cookie_warning();
    ?>

    @ksaffy: yeah actually i’m a python programmer & not a php. But i’m forced to use php for dis project. Kindly look at my question (http://wordpress.org/support/topic/how-to-display-the-favourite-post-list-with-thumbnail-image-pinboard-theme) and if u have any idea reply me

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Show Favorites page in grid??’ is closed to new replies.