Allowing the SoundCloud player to appear in a post excerpt

The excerpt will only fetch the text, triming tags. You need to make a new custom field (you can use Advanced Custom Fields) for the ID of that iframe. Then, you need to edit your content_excerpt.php (I don’t know wich theme are using) and fetch that field instead or below your excerpt. For example: (using … Read more

Frontend Post Excerpt field mapping

I haven’t tried the Gravity Forms plugin but if you are using the wp_insert_post function to insert the new post, you just use ‘post_excerpt’. example: $new_post = array( ‘post_title’ => ‘Post Title’, ‘post_content’ => ‘Post Content’, ‘post_status’ => ‘publish’, ‘post_excerpt’ => $custom_excerpt_field ); wp_insert_post($new_post); Not sure if I completely understand your question, so I’ve misunderstood … Read more

How Can A Plugin Hook Itself To the End of Every Excerpt?

From the codex there are a couple of possible filters for you to try: get_the_excerpt the_excerpt – look at @Mayeenul’s link for usage suggestions Personally I would try the first one with something like: function fileterExcerpt($excerpt){ if(has_excerpt()){ $excerpt .= “Some extra text”; } return $excerpt; } add_filter( ‘get_the_excerpt’, ‘filterExcerpt’ ); Hope this helps.

adjust the_excerpt based on template page

You can add it straight to the template before the header in most cases… <?php /* Template Name: Products */ ?> <?php add_filter( ‘excerpt_length’, function( $length ) { return 10; }, 999); get_header(); ?> These should work as well if you’d rather put in functions.php: Method 2: In the loop $slug = get_page_template_slug($post->ID); if(‘page-products.php’ == … Read more

How to limit 1 image per post on homepage only?

/** * @author: wpreceipes * @link: [1]: http://www.wprecipes.com/how-to-get-the-first-image-from-the-post-and-display-it */ function wpse18215_catch_that_image() { global $post, $posts; $first_img = ”; ob_start(); ob_end_clean(); $output = preg_match_all( ‘/<img.+src=[\'”]([^\'”]+)[\'”].*>/i’, $post->post_content, $matches ); $first_img = $matches[1][0]; //Defines a default image if( empty( $first_img ) ) { $first_img = ‘/images/default.jpg’; } return $first_img; } Example: echo catch_that_image(); or: /** * @author: Marcelo … Read more