Help needed using wp_trim_words

Keep in mind that a post excerpt is not always just the first X words of a post, so while wp_trim_words() could work under certain situations, it’s a pretty rigid solution. If you don’t want to deal with reverse-engineering the encrypted/obfuscated source file (shame on whoever did that), you might be able to get clever … Read more

Show only the beginning of post

Try replacing this: <?php /* Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( ‘content’, ( post_type_supports( get_post_type(), ‘post-formats’ ) ? get_post_format() : get_post_type() … Read more

Keep custom read more link on the same line as excerpt text

Simple function that changes the output of the “[…..]” text and replace with the permalink. function bm_excerpt_more_link( $more ) { $post = get_post(); return ‘<a href=”‘.get_the_permalink($post->ID).'”>Read More…</a>’; } add_filter( ‘excerpt_more’, ‘bm_excerpt_more_link’, 21 ); Or you can remove “p” tag by adding this below line before your post loop. remove_filter(‘the_excerpt’, ‘wpautop’);

How to display post excerpt beside post list inside Post of Dashboard

Please add follwing line of code in your theme’s function.php to display a new column which will display excerpt in your posts. function pkb_get_excerpt($post_ID) { $content_post = get_post($post_ID); $content = $content_post->post_content; if ($content) { return $content; } } // ADD NEW COLUMN function pkb_columns_head($defaults) { $defaults[‘excerpt’] = ‘excerpt’; return $defaults; } // SHOW THE EXCERPT … Read more

Highlight search words in excerpt

Use str_replace to replace all occurances of the word to highlight with a around the word. Something like // $searchresult = result of search process, //$highlightword = word you want to highlight $searchresult = str_replace( $highlightword, “<span style=”background-color:#ffff00;”>$highlightword</span>”, $searchresult ); Adjust the background-color to what you want to use. To limit the number of words … Read more

Hide disclaimer from summary excerpts

You could do something like this: /* Add disclaimer to top of POSTS that contain affiliate tag */ function tt_filter_the_content( $content ) { if (has_tag(‘affiliate’) && is_single()) $custom_content=”<hr><p><em>Disclosure: This post contains affiliate links and we may receive a referral fee (at no extra cost to you) if you sign up or purchase products or services … Read more

Excerpt isn’t working or am I missing something?

No it’s not. The length limit is for excerpt, which should be called manually. To get the excerpt in your loop, you should use: <p><?php the_excerpt(); ?></p> Instead of: <p><?php the_content(); ?></p> If you thought of this because of the option in the reading section of settings: Then you have to notice, this is for … Read more

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