WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Naoise Golden Santos
    Member
    Posted 3 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?
    if(has_post_thumbnail($single->ID)){
    	$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.

    Saludos

    http://wordpress.org/extend/plugins/list-category-posts/

  2. mpat13
    Member
    Posted 3 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
    Member
    Posted 3 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

    http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail

  4. martinnecas
    Member
    Posted 3 years ago #

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

  5. amycarolyn
    Member
    Posted 3 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

About this Topic