Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wordpress limit post content length

function get_excerpt(){
$excerpt = get_the_content();
$excerpt = preg_replace(" ([.*?])",'',$excerpt);
$excerpt = strip_shortcodes($excerpt);
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, 50);
$excerpt = substr($excerpt, 0, strripos($excerpt, " "));
$excerpt = trim(preg_replace( '/s+/', ' ', $excerpt));
$excerpt = $excerpt.'... <a href="'.get_the_permalink().'">more</a>';
return $excerpt;
}
Comment

PREVIOUS NEXT
Code Example
Php :: How do I get a YouTube video thumbnail from the YouTube API? 
Php :: The "AppEntity entity has a repositoryClass set to but this is not a valid class. 
Php :: json_encode() 
Php :: php if input is empty 
Php :: parse json phph 
Php :: php curl detect 404 
Php :: jsondecode php array 
Php :: Download any version of xampp 
Php :: laravel copy image with new name 
Php :: mac install php-fpm 
Php :: wocommerce product image 
Php :: laravel model factory attribute 
Php :: get shipping price of choosen shipping method woocommerce 
Php :: spaceship operator php 
Php :: display data from two dimensional array in vew laravel 
Php :: laravel middleware 
Php :: acosh php 
Php :: php dirname 
Php :: php explode empty string 
Php :: execute script php command line 
Php :: php value in array 
Php :: display name cat product woocommerce 
Php :: sum two numbers in php 
Php :: cakephp login session 
Php :: php number multiple of 
Php :: softdelete laravel 
Php :: add slashes to string 
Php :: wp php footer date automatically 
Php :: year dropdown loop in php 
Php :: woocommerce unset custom checkout field 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =