WordPress.org

Ready to get started?Download WordPress

Forums

WP Favorite Posts
Can I sjow Images? (18 posts)

  1. piticstyle
    Member
    Posted 3 years ago #

    Hy, I want to show images beside links, can i do that with this plugin? Thank you.

    http://wordpress.org/extend/plugins/wp-favorite-posts/

  2. Dave Wright
    Member
    Posted 3 years ago #

    Hi, I'm trying to do this also, perfect plugin if only I could figure out how to display post_thumbnails.

  3. Stefan
    Member
    Posted 3 years ago #

    Hi

    Anyone worked out how to do this?

  4. Dave Wright
    Member
    Posted 3 years ago #

    Hi, I amended the plugin to acheive this,
    try the following in your wpfp-page-template.php

    $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 );
    			echo "</a>";
    			echo "</div></div>";

    I can't remember what was there before but it should be pretty easy to find the snippet.
    Hope this helps

  5. Stefan
    Member
    Posted 3 years ago #

    Thanks Dave

    All makes sense. I tried it but it's not displaying the thumbnails. Check the HTML and there's nothing in there either.

    Any thoughts?

    Ideally I'd like the large image associated with the post to be dispalyed - I'm trying to build a favourites page for a photo gallery.

    Cheers

    Stefan

  6. Stefan
    Member
    Posted 3 years ago #

    Anyone else know how to add a post image to the favorites list?

    Any help much appreciated.

  7. duskio
    Member
    Posted 3 years ago #

    Thanks Dave for good hint.
    But I need modify that code little more... Can some1 help?

    $p = get_post($post_id);
          echo get_template_part( 'templates/post/post-header' );
          echo "<div class='postContent'>";
          echo "<a href='".get_permalink($post_id)."'>";
    			echo get_the_post_thumbnail( $post_id );
    			echo "<br>";
    			echo "<a href='".get_permalink($post_id)."' title='". $p->post_title ."'>" . $p->post_title . "</a> ";

    - I made this, BUT... It takes name of page (favorite posts) to header of each post, but I need post id... Is there any possibility to make it?
    - I need to get the thumbnail smaller like 150x150 px. How Can I?
    Pls help. Thank you!

  8. Dave Wright
    Member
    Posted 3 years ago #

    Hi, untested but try...

    $p = get_post($post_id);
          echo the_id();
          echo "<div class='postContent'>";
          echo "<a href='".get_permalink($post_id)."'>";
    			echo get_the_post_thumbnail( $post_id,'smallthumb' );
    			echo "<br>";
    			echo "<a href='".get_permalink($post_id)."' title='". $p->post_title ."'>" . $p->post_title . "</a> ";

    Here I've changed the "get template part" line to echo the ID and added the argument "smallthumb" to the thumbnail. Your code should now look for the smallthumb sized thumbnail.

    The next step is to create this thumbnail size by adding the following into your functions.php

    add_image_size( 'smallthumb', 150, 150);

    So from now on all new images you upload will automatically have a 150x150 pixel version you can call up.

    Finally you may have to re-build your old thumbnails, this is to make sure images you have previously uploaded have a smallthumb (150x150) version you can call upon. If you search the plugin repository for thumbnail rebuild or similar you'll find there are a few tools for the job.

    Let us know how you get on

  9. duskio
    Member
    Posted 3 years ago #

    Thank you very much :) thumbnail works perfectly but...
    this echo the_id(); says just 20 on my page (???)

    And I made new template part post-header-favorites and there is a code <h2 class="postTitle"><a href="<?php the_permalink($post_id) ?>" title="<?php _e('Permalink to', 'Arjuna'); ?> <?php the_title(); ?>"><span><?php the_title(); ?></span></a></h2> for getting Title, but this code takes title from page "favorite posts" so every favorite post on this page have Title in this template part "favorite post" :D. Can I somehow change it for post title?

    Thanks for any helps and hints :)

  10. Dave Wright
    Member
    Posted 3 years ago #

    hi, echo the_id will always give you the numeric ID for a post, thought thats what you wanted, try changing
    echo the_id();
    to
    echo the_title();

  11. duskio
    Member
    Posted 3 years ago #

    again favorite post...

    btw.
    <a href='".get_permalink($post_id)."' title='". $p->post_title ."'>" . $p->post_title . "</a> works here and its normal link to post but I need get this "function" to this code->
    <h2 class="postTitle"><a href="<?php the_permalink($post_id) ?>" title="<?php _e('Permalink to', 'Arjuna'); ?> <?php the_title(); ?>"><span><?php the_title(); ?></span></a></h2> bcs its a link for each post

  12. duskio
    Member
    Posted 3 years ago #

    Hi Dave,
    another vision :D
    Can i get this thumbnails with titles to 3 columns? I mean like pexeso view :D...

  13. learner24
    Member
    Posted 3 years ago #

    someone please help,
    when I put echo get_the_post_thumbnail ( $post_id );
    in wpfp-page-template.php,
    I get Fatal error: Call to undefined function get_the_post_thumbnail()
    please help, thanks.

  14. learner24
    Member
    Posted 3 years ago #

    hey duskio,
    Did you change any thing else accept wpfp-page-template.php ??
    I am asking because the code: `$p = get_post($post_id);
    echo the_id();
    echo "<div class='posts'>";
    echo "<a href='".get_permalink($post_id)."'>";
    echo get_the_post_thumbnail( $post_id );
    echo "<br>";
    echo "<a href='".get_permalink($post_id)."' title='". $p->post_title ."'>" . $p->post_title . "</a> ";`

    is not working from me, it gives me Fatal error: Call to undefined function get_the_post_thumbnail()

    I am using the wordpress 3.2

    please help...

  15. duskio
    Member
    Posted 3 years ago #

    no i didnĀ“t maybe u dont have this add_theme_support( 'post-thumbnails' ); in your function.php?

  16. havenner
    Member
    Posted 2 years ago #

    Okay, I got a few of these requests to work. The trick was to break up all of the php echos on the wpfp-page-template.php so you can add styling in between commands. In my example, I separated the image and the excerpt of the favoritepost into a table and positioned the title of the post above the image.

    Here's how it looks: (Note that the post excerpt is called using added code in WordPress' function.php file found here -- need to add this code in order to call the post excerpt when it is outside of the loop):

    [Code moderated as per the Forum Rules. Please use the pastebin]

  17. joelogic
    Member
    Posted 2 years ago #

    For the wootheme that I am using, I put this in the wpfp-page-template.php:-

    [Code moderated as per the Forum Rules. Please use the pastebin]

    also added the target so that the link opened in a new tab/page.

    I am not really a coder, but another thing that would good is showing images/thumbnails in the 'Most Favorited' widget, can't seem to get that to work, anyone have any ideas?

  18. aimkbe
    Member
    Posted 2 years ago #

    How do i llink my image to a post?

    echo "
    <ul>";
        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='postContent'>";
                echo get_the_post_thumbnail ( $post_id,'smallthumb' );
    			echo "";
    	    echo "<a href='".get_permalink($post_id)."'>post_title ."'>" . $p->post_title . "</a> ";   ' </ul>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic