List category posts
Code enhancement: post thumbnail & shortcodes in excerpt (5 posts)

  1. Naoise Golden Santos
    Posted 5 years ago #

    Hello, first thank you for this simple and powerful plugin, it is just what I was looking for. Te lo has currao.

    Then I wanted to post two lines of code I implemented in my custom template, which I think would be handy if put in the original code for the next update:

    Add the new Featured Image option in WP3 or "post thumbnail"

    //Show thumbnail?
    	$lcp_output .= '<a href="' . get_permalink($single->ID) . '">' . get_the_post_thumbnail($single->ID, array('100','100')) . '</a>';

    Parse shorcodes in the excerpt

    //Show excerpt?
    if($atts['excerpt']=='yes' && !($atts['content']=='yes' && $single->post_content) ){
    	$lcpcontent = apply_filters('the_content', lcp_excerpt($single)); // added to parse shortcodes
    	$lcpcontent = str_replace(']]>', ']]&gt', $lcpcontent); // added to parse shortcodes
    	$lcp_output .= $lcpcontent;

    I don't know if it's the best way to implement those things but they work for me. I hope it's useful.

    Thanks again and continue with the good work.



  2. mpat13
    Posted 5 years ago #

    Great aad on THANKS!

    Just one more thing if you coul help...

    How can i add a thumbnail class in . get_the_post_thumbnail($single->ID, array('100','100')) .

    for example i want to add the following class:

    <img class="post_thumbnail1">

    Thanks again for the great add on

  3. Naoise Golden Santos
    Posted 5 years ago #

    . get_the_post_thumbnail($single->ID, array('100','100'), array('class' => "post_thumbnail")) .

    I haven't tried but it should work since it is mentioned in the get_the_post_thumbnail function reference


  4. martinnecas
    Posted 5 years ago #

    Much appreciated! Works like a charm.
    Thanks. // Martin

  5. amycarolyn
    Posted 5 years ago #

    My theme uses get_the_image to grab the first image in the post. Does anyone know how can I apply that in a template instead of having to assign a Featured Image?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • List category posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic