Excerpt – add the last few words of posts to the […]

You can achieve this by using the_excerpt filter. You can read further on the codex. Just paste this code in functions.php and set the value of $i = no of words from the end you want. add_filter(‘the_excerpt’,’my_excerpt’); function my_excerpt(){ global $post; $excerpt=get_the_excerpt(); $content = get_the_content(); //gets the whole content $content =strip_tags($content) ; //strips html tags … Read more

Auto Populate Excerpt Field

How about using the excerpt_length filter? function my_excerpt_lenght( $length ) { return 15; } add_filter( ‘excerpt_length’, ‘my_excerpt_lenght’, 999 );

the_excerpt – want to modify password protected output

Simple way would be to check output in template (or small wrapper): $excerpt = get_the_excerpt(); if( ‘There is no excerpt because this is a protected post.’ == $excerpt ) { // stuff } else { echo $excerpt; } Another way would be to use gettext filter (which is used inside __()) to catch and modify … Read more

Show read more link next to last word

The only thing that makes sense to me is that $text immediately after this line: $text = force_balance_tags($out); Has something that wpautop translates as a paragraph break– something like a double newline. Untested, but I would think that trim would clear it up. $text = trim($text) . $excerpt_end;

Display oEmbed in the_excerpt

Without knowing more about your theme I can only hazard a few guesses. What are you inputting as an excerpt, what is the current output you are seeing for your excerpt, and what is the expected output? Are you seeing the URL show up in the excerpt, or is it being stripped? Oembed Are you … Read more

Change excerpt length of first post

Use the current_post property of the WP_Query object: function new_excerpt_length($length) { global $wp_query; // assuming you are using the main query if ( 0 === $wp_query->current_post) return 50; else return 20; } The function may need further tweaks to avoid interfering with other queries in unintended ways, but that is the basic idea.

Getting first 20 words without excerpt

Use wp_trim_words() wp_trim_words( get_the_content(), 20 ) As you’re outside the main loop wp_trim_words( $recent[ ‘post_content’ ], 20 ) If you want to apply the same filters as to the_content() in the main loop wp_trim_words( apply_filters( ‘the_content’, $recent[ ‘post_content’ ] ), 20 )

Writing a custom excerpt function

The easiest way is to use strip_tags(). // Remove all html from the excerpt. function custom_excerpt( $text ) { return strip_tags( $text ); } add_filter( ‘the_excerpt’, ‘custom_excerpt’ ); If you want to get fancy and trim the excerpt length, you can use this function. // Trim default excerpt length from 55 chars to 20. function … Read more

How to display links in excerpt? [duplicate]

First, I would suggest that you combine your p and a tags into one line, like so: $text = strip_tags($text, ‘<p><a>’); Second, the remove_filter and add_filter should go in your functions.php file, not content.php…..move those lines to just below the $text = strip_tags….. I don’t think you need the line that has $main_content = apply_filters … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)