Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author akyusa01

    (@akyusa01)

    The plugin already uses “the_excerpt” – if you have text placed in the_excerpt box on WP this is all you need.

    However, we have a function in the cr3ativ-recentposts.php that limits the excerpt as shown below:

    function get_excerpt_by_id($post_id){
    $the_post = get_post($post_id); //Gets post ID
    $the_excerpt = $the_post->post_content; //Gets post_content to be used as a basis for the excerpt
    $excerpt_length = 35; //Sets excerpt length by word count
    $the_excerpt = strip_tags(strip_shortcodes($the_excerpt)); //Strips tags and images
    $words = explode(' ', $the_excerpt, $excerpt_length + 1);
    if(count($words) > $excerpt_length) :
    array_pop($words);
    array_push($words, '…');
    $the_excerpt = implode(' ', $words);
    endif;
    $the_excerpt = '<p>' . $the_excerpt . '</p>';
    return $the_excerpt;
    }

    So if you want to change it back to default, you would need to remove the above from the file mentioned, but everytime you update the plugin, it will get placed back in.

    Thread Starter kalookalei

    (@kalookalei)

    That code returns an excerpt pulled from the first words of the post. It does not return what is in the excerpt box of the post. If you take a look at my page jumpjammies.com you will see that the excerpts begin with “Purchase at Amazon”. In the excerpt box of the posts I do not include that phrase since links are removed from excerpts. I.e. for the Etsy book the excerpt should be, “This ebook – Sell Digital Products Using Etsy – shows you how to set up an online store on Etsy.com.”

    Plugin Author akyusa01

    (@akyusa01)

    It only pulls from the first words of the post if there is nothing in the excerpt box from WordPress, this is a standard php call.

    Thread Starter kalookalei

    (@kalookalei)

    I do have text in the excerpt box.

    As I understand it in order to retrieve the information from the excerpt box there needs to be a call to the_excerpt like:

    `<?php $excerpt = get_the_excerpt() ?>

    Your call goes to excerpt_by_id($post_id)not the_excerpt so what is in the excerpt is not being returned.

    I really do love your plugin.

    Plugin Author akyusa01

    (@akyusa01)

    Ahhh, yes, I see it now, sorry – I’ve been sick, I guess my brain isn’t in gear.

    Let me look into this further and see what I can come up with.

    I just updated the plugin to include the new js for the owl script, but I may have to put in another one to correct whatever is causing this.

    Just give me some time to test.

    Plugin Author akyusa01

    (@akyusa01)

    Sorry – I just started to run tests on this and it worked for me straight away. Sounds like your theme that you are using could be doing something different.

    Here’s a couple of screen shots:

    https://dl.dropboxusercontent.com/u/3117718/entered-the-excerpt.png

    https://dl.dropboxusercontent.com/u/3117718/echos-the-excerpt.png

    Thread Starter kalookalei

    (@kalookalei)

    I tested with Twenty Fifteen and still got the first few lines of the post and not what was in the excerpt box.

    I did find a solution I think. If you change the line
    $temp_excerpt = get_excerpt_by_id($post->ID);

    to
    $temp_excerpt = get_the_excerpt();

    then the contents of the excerpt box are displayed both in my theme and in Twenty Fifteen. I’m hoping this does not interfere with any other code.

    Plugin Author akyusa01

    (@akyusa01)

    That’s very strange because I didn’t change anything – tested on 2012 and everything worked fine.

    Let me test this today and if it all works out, there should be another update to the plugin today for you to correct this issue.

    Really sorry for any inconvenience this is causing.

    Plugin Author akyusa01

    (@akyusa01)

    Ok, I’m pushing an update out now for you.

    Plugin Author akyusa01

    (@akyusa01)

    I’m pushing out another update to remove the owl script 2.0 due to many issues. The get_the_excerpt will stand, but just the js is what I’m touching on this next update.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Get_the_excerpt’ is closed to new replies.