Excerpt – First Sentence & Read More
To append strings in PHP use ., like: return $sentence[‘0’] . $sentence[‘1’] . “… Read More”;
To append strings in PHP use ., like: return $sentence[‘0’] . $sentence[‘1’] . “… Read More”;
the_content echoes post content. It does not return a string that you can manipulate. You need get_the_content() Swap those functions and it should work.
You can use this function wp_trim_words(). It allows you to format the output, and strips all the HTML tags in the content (it uses wp_strip_all_tags). You will have to pass post_content as the first paramenter.
Answer on my own question (without using a plugin and choosing a middle way) for what we want to achieve. Because the template has also a code starting with: if ( has_post_thumbnail() && ( $post->post_type == ‘post’ ) ) we have taken that part of code away. (we won’t used it in postings/pages, therefore) Following … Read more
The get_template_part(‘content’, get_post_format()); line includes content from one of the other files in your theme based on the post type, the file name will be something like content-page.php (or content.php if the format is not found). If you print out what get_post_format() returns, you will be able to tell which content file to look into. … Read more
Depending on where in the loop you call excerpt() wpautop might be creating the <p>…</p> wrapper. In that case, you could wrap $excerpt with <p>…</p> before returning it. Edit: Try this approach <?php echo excerpt(25).”\n”;?> (or possibly “\n\n”) to change the behavior. in function awesome_excerpt() you have $text = substr( $content, 0, strpos( $content, ‘</p>’ … Read more
Does that post have an excerpt manually entered? the filter only works on excerpts when they’re pulled from the post content.
Certainly: use the “Excerpt” textarea on the Post Edit screen. It should be immediately beneath the “Content” textarea; if not, check Screen Options (tab in the upper right-hand corner), and ensure that the “Excerpt” checkbox is enabled/checked.
This plugin should help you. It ads the Excerpt Meta box to the Edit Page: http://wordpress.org/extend/plugins/page-excerpts-for-wordpress-three/ Good luck!
Hopefully I’m understanding what you want correctly. I think you are going to need to wrap the content itself in a div called something like excerpt_content and make that an inline block that’s aligned to the top. Then you can use the has_post_thumbnail() as a conditional to assign it another class to limit the width … Read more