Allow latex in wordpress excerpt

If I’m not mistaken, this could be as simple as add_filter(‘get_the_excerpt’, ‘latex_markup’); if the Latex markup isn’t removed by another filter before that (it shouldn’t, I believe). latex_markup is the function jetpack adds to the list of filters on the_content. It might get interesting when your latex code is at the edge of the excerpt … Read more

can hyperlinks be displayed in excerpts?

WordPress uses the filter wp_trim_excerpt to strip the tags. You can remove the filter and create your own which will allow the links: <?php function new_wp_trim_excerpt($text) { $raw_excerpt = $text; if ( ” == $text ) { $text = get_the_content(”); $text = strip_shortcodes( $text ); $text = apply_filters(‘the_content’, $text); $text = str_replace(‘]]>’, ‘]]>’, $text); $text … Read more

Exclude filter on front page

You can just remove the filter before calling the_excerpt and then add it back afterwards… remove_filter(‘excerpt_more’,’new_excerpt_more’); the_excerpt(); add_filter(‘excerpt_more’, ‘new_excerpt_more’);

Trim first 2 words of the exceprt

A more reliable way would be to filter the excerpt and to explode the string into an array, remove the first two key/value pairs from the array and then return your string add_filter( ‘wp_trim_excerpt’, function ( $text ) { // Make sure we have a text if ( !$text ) return $text; $text = ltrim( … Read more

Empty excerpt using wp_get_recent_posts

The post_excerpt value is empty because you have no explicit excerpts for your posts. While the_excerpt() does generate an excerpt from the posts content if the post excerpt is empty, the function wp_get_recent_posts(), which is basically a wrapper for get_posts(), doesn’t.

Read more does not show up when I write my own Excerpt

Perhaps a conditional statement like the following will work. The logic is: “If the post has an explicit excerpt, add a read more link. Otherwise, use default excerpt behavior.” if($post->post_excerpt) { the_excerpt(); echo ‘<a href=”‘.get_permalink().'”>Read More</a>’; } else { the_excerpt(); } You can use this in combination with Gavin’s suggestion to unify the appearance of … Read more

Custom wp_trim_words() function not trimming right

What about using this function in functions.php: function new_excerpt_length($length) { return 20; } add_filter(‘excerpt_length’, ‘new_excerpt_length’); And then getting it by adding<?php the_excerpt()?> to php template? OR: <?php $string = get_the_excerpt(); if (strlen($string) <=20) {echo ” . $string . ”;} else {echo ” . substr($string, 0, 20) . ‘…’;}?> In this case 20 is characters

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