Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ********How to add auto post excerpt function in wordpress from it-bari tutorial **********
- //first past this code in function.php to register excerpt function
- /*This Code is For Read More Function*/
- function excerpt($num) {
- $limit = $num+1;
- $excerpt = explode(' ', get_the_excerpt(), $limit);
- array_pop($excerpt);
- $excerpt = implode(" ",$excerpt)." <a href='" .get_permalink($post->ID) ." ' id='".readmore."'>Read More</a>";
- echo $excerpt;
- }
- function wpse_filter_excerpt_length( $length ) {
- if ( is_front_page() ) {
- return 55; // change this to number of words you want on homepage.
- } else {
- return $length;
- }
- }
- add_filter( 'excerpt_length', 'wpse_filter_excerpt_length', 999 );
- //than use this code to call post content
- <?php echo excerpt('55'); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement