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

How to correctly limit the content and strip HTML?

First, I wouldn’t modify the string/word length of the content. Semantically, you’re dealing with an excerpt, so let’s focus on that. Second, to limit the number of words returned for the excerpt, simply filter excerpt_length: <?php function wpse52673_filter_excerpt_length( $length ) { // Return (integer) value for // word-length of excerpt return 150; } add_filter( ‘excerpt_length’, … Read more

First letter cutting off in excerpt

I’m going to give you a hard-coded solution to this problem, rather than using a plugin. If you’re heart is set on a plugin that is fine – but this short code is rather simple and hopefully helpful for your purposes. This code is basically just adding a CSS class to a shortcode. First, deactivate … Read more

Auto Refresh Post List after X seconds

Your answer definitely falls within the realm of AJAX. If you are using a form, try setting the onsubmit eventListener equal to return false; (plus any other needed attributes) like so: <form onsubmit=”return false;”> Then you send a post and parse it with PHP and depending on your desired effect, and the input of the … Read more

Extending wordpress search to include excerpts and taxonomies?

With WordPress 4.2.2 I’m using the following (admittedly fragile) method to search excerpts as well as the content and title without a plugin. This is the relevant snippet from functions.php. add_filter(‘posts_where’, ‘custom_posts_where’); function custom_posts_where($where) { if (is_search()) { $where = preg_replace( “/(\w+).post_title LIKE (‘%.*?%’)/”, “$1.post_title LIKE $2) OR ($1.post_excerpt LIKE $2”, $where); } return $where; … Read more