WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type List Widget
[resolved] how to add images and excerpt to plugin feed (4 posts)

  1. callender
    Member
    Posted 2 years ago #

    Hi there,

    I have the latest two posts showing in the sidebar using this widget.

    How do I also add the image thumbnail and excerpt for this widget?

    If you can let me know what code to put in the php for this plugin then that should sort it out.

    Thank you,

    J

    http://wordpress.org/extend/plugins/custom-post-type-list-widget/

  2. Alan Hidalgo Pagoto
    Member
    Posted 1 year ago #

    Hey guy! How are you doing? I don't know if you're still in doubt but I'm posting the way which I've done to fix this problem.
    I've editted the code between the lines 198 and 210 on custom-post-type-list-widget.php file. When you change $out variable, you're changing your output content. Then you use the get_the_post_thumbnail() function. My code ended up being as folow:

    $out.= "\r\n<div class=\"item-sugestao-leitura\">".get_the_post_thumbnail($ID, array(66,94))."$post_title

    Autor:
    ".$livro_autor[0]."<div class=\"clearfloat-sugestao-leitura\"></div></div>";

    Where $ID is the id of my post, array(66,94) are the dimensions of the thumbnail and $livro_autor is a variable which receives a meta value:

    $livro_autor=get_post_meta($ID, 'livro-autor');

    Anywaw, keep in touch if you're still in doubt
    See you,
    Alan Hidalgo Pagoto
    Curitiba/PR - Brazil

  3. Alan Hidalgo Pagoto
    Member
    Posted 1 year ago #

    Sorry...

    $out.= "\r\n<div class=\"item-sugestao-leitura\">".get_the_post_thumbnail($ID, array(66,94))."$post_title

    Autor: ".$livro_autor[0]."<div class=\"clearfloat-sugestao-leitura\"></div></div>";

  4. callender
    Member
    Posted 1 year ago #

    thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic