the_excerpt() in content.php and get_template_part() in single.php

the_content() does not grab the PHP file content.php, it simply displays a Post’s content. Likewise, the_excerpt() grabs the excerpt of a post. get_template_part simply finds a file within your theme named whatever you put in, with an optional suffix. get_template_part( ‘content’ ); // content.php get_template_part( ‘content’, ‘my_page’ ); // content-my_page.php in order for make different … Read more

get_the_excerpt without images

You may try the following code. $content = get_the_excerpt(); $content = preg_replace(“/<img(.*?)>/si”, “”, $content); echo $content; preg_replace will remove the image tag content from the post content.

Include an image within auto the_excerpt?

Yes, you can do that, but you’ll need to tweak the <?php the_excerpt(); ?> function. This is a good article on how to do that: http://aaronrussell.co.uk/legacy/improving-wordpress-the_excerpt/ To sum up the article in case it goes away, put this in your theme’s functions.php file: function improved_trim_excerpt($text) { global $post; if ( ” == $text ) { … Read more

My custom get_the_excerpt() can’t get excerpt by ID

Try this one /* Change Excerpt length */ function excerpt($num, $post_id) { // removed empty default value $limit = $num+1; $excerpt = apply_filters(‘the_excerpt’, get_post_field(‘post_excerpt’, $post_id)); $excerpt = explode(‘ ‘, $excerpt, $limit); array_pop($excerpt); $excerpt = implode(” “,$excerpt).”&#8230”; echo $excerpt; } Another solution – using setup_postdata($post); and wp_reset_postdata(); function custom_get_the_excerpt($post_id) { global $post; $save_post = $post; $post … Read more

Removing h3s in excerpt output?

There’s a discussion on WP Support Forum that was related to your question. The pastebin constains the function stated in the other answer. I’ve decreased the priority to 5 and it works on my test theme. add_filter( ‘get_the_excerpt’, ‘wp_strip_header_tags’, 5); If you want to target only <h3> you can use this regex: $regex = ‘#(<h([3])[^>]*>)\s?(.*)?\s?(<\/h\2>)#’;

Automating Excerpt

The excerpt filter by default cuts your post by a word count, which I think is probably preferable to a character-based substr function like you’re doing, and it strings out tags and images as well while doing it. You can set the number of words to excerpt with the filter excerpt_length (it defaults to 55 … Read more

Add “Excerpt” in “Quick edit”

I too am looking for this option / feature. I came across this guys explanation which I believe answers most of the question. I am in the process of implementing this so I cannot say how accurate it is being a wordpress noob (not php!), I do realise this is for a custom box but … Read more

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