Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Wendihihihi

    (@wendihihihi)

    Would this work?

    // Get post excerpt
    				$moretaggg = get_extended ($post->post_content);
    				$the_excerpt = $moretaggg['main'];
    				$the_excerpt = strip_tags(strip_shortcodes($the_excerpt));
    				//$words = explode(' ', $the_excerpt, $excerpt_length + 1);
    				//if(count($words) > $excerpt_length)
    				//{
    				//	array_pop($words);
    				//	array_push($words, '...');
    				//	$the_excerpt = implode(' ', $words);
    				//}
    Plugin Author storeapps

    (@storeapps)

    @wendihihihi,

    Would like to update you that by default Email Subscribers displays only 50 words in the newsletter content.

    Further, you can simply search for below line of code in the ’email-subscribers/classes/es-sendmail.php’ and change the value as per your requirement.

    $excerpt_length = 50;

    Also, your solution seems fine but in either case you would need to maintain the changes before updating to any newer version.

    Plugin Author storeapps

    (@storeapps)

    @wendihihihi,

    Also, if you need the entire post_content in then newsletter then you can use ###POSTFULL### instead of ###POSTDESC###

    Thread Starter Wendihihihi

    (@wendihihihi)

    Hi storeapps,

    Yes, I saw that the default for the_excerpt is 50 words. The post text is not always the same length. That’s why I look for a different solution. There is one client who has a recipe website. He starts with the recipe intro and after that the ingredients. He wants only to send the intro part. With the_excerpt he’ll get some of the ingredients in the email which doesn’t look nice.

    I understand that the_excerpt will work for most people, because they don’t use the more tag. But for the ones that use the more tag a keyword like ###POSTMORETAG### would be great ??

    Something like this?

    // Get post excerpt
    $the_excerpt = $post->post_content;
    $the_excerpt = strip_tags(strip_shortcodes($the_excerpt));
    $words = explode(‘ ‘, $the_excerpt, $excerpt_length + 1);
    if(count($words) > $excerpt_length)
    {
    array_pop($words);
    array_push($words, ‘…’);
    $the_excerpt = implode(‘ ‘, $words);
    }

    // Get post until more tag
    $text_until_more_tag = get_extended ($post->post_content);
    $until_more_tag = $text_until_more_tag[‘main’];
    $until_more_tag = strip_tags(strip_shortcodes($until_more_tag));

    if ( (function_exists(‘has_post_thumbnail’)) && (has_post_thumbnail($post_id)) )
    {
    $post_thumbnail = get_the_post_thumbnail($post_id, ‘full’);
    }

    if($post_thumbnail <> “”)
    {
    $post_thumbnail_link = ““.$post_thumbnail.”“;
    }

    $content = str_replace(‘###POSTLINK-ONLY###’, $post_link, $content);

    if($post_link <> “”)
    {
    $post_link_with_title = ““.$post_title.”“;
    $content = str_replace(‘###POSTLINK-WITHTITLE###’, $post_link_with_title, $content);

    $post_link = ““.$post_link.”“;
    }

    $content = str_replace(‘###POSTTITLE###’, $post_title, $content);
    $content = str_replace(‘###POSTLINK###’, $post_link, $content);
    $content = str_replace(‘###POSTIMAGE###’, $post_thumbnail_link, $content);
    $content = str_replace(‘###POSTDESC###’, $the_excerpt, $content);
    $content = str_replace(‘###POSTMORETAG###’, $until_more_tag, $content);
    $content = str_replace(‘###POSTFULL###’, $post_full, $content);
    $content = str_replace(‘###DATE###’, $post_date, $content);
    break;

    Thank you for pointing out ###POSTFULL###. Might come in handy one day.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘###POSTDESC### only text until more tag’ is closed to new replies.