how can i take wordpress post as embed?
how can i take wordpress post as embed?
I just found the right solution: function rss_post_thumbnail($content) { global $post; if(has_post_thumbnail($post->ID)) { $output=”<p>” . get_the_post_thumbnail($post->ID) . ‘</p>’; } return $output . $content; } add_filter(‘the_excerpt_rss’, ‘rss_post_thumbnail’, 20, 1); add_filter(‘the_content_feed’, ‘rss_post_thumbnail’, 20, 1);
how can i take wordpress post as embed?
Before the_content is displayed WP looks for filters to run the content through. One of those filters is do_shortcode. The idea of a filter is that you can change something before it is displayed. As a consequence, if inside the filter function you echo something, it ends up before the_content, which is still waiting for … Read more
WordPress v5.4.2 escapes the content of Edit Attachment > Description field
i am using astrid theme so we have to put this code below 49 line in class=”entry-summary” wp-content\themes\astrid\template-parts\content.php
You need to switch get_permalink to the_permalink or echo esc_url(get_permalink). get_permalink the_permalink
according to the documentation, it is more correct to change the length of the excerpt using add_filter: add_filter( ‘excerpt_length’, function(){ return 10; }); you can make your own function based on this, like this: add_filter( ‘excerpt_length’, ‘new_excerpt’, 10, 1); function new_excerpt( $lenth ){ return $length; }); … apply_filters( ‘excerpt_length’, 150 );
I came up with this, which seems to work. Notes: It adds the custom HTML before the very first image / media embed in a post’s content; if there are more than one image / video, it’ll only place the custom HTML once It requires the innerpostvideo div you mentioned in your question You can … Read more
just change the $post->ID with get_post_thumbnail_id(), and possibly we can delete also the global $post; if( ! ( function_exists( ‘add_alt_image_content’ ) ) ) { function add_alt_image_content( $content ) { if ( is_single() && in_the_loop() && is_main_query() ) { global $post; $image = get_post(get_post_thumbnail_id()); $image_title = $image->post_title; $pattern = ‘~(<img.*? alt=”)(“[^>]*>)~i’; $replace=”$1”.$image_title.’$2′; $content = preg_replace( $pattern, … Read more
We can drop this question, please. The page probably loops when it lists itself. I must just find a way to exclude listing itself. Sorry. This is what was missing $args = array( ‘post_type’ => ‘post’, ‘post__not_in’ => array(get_the_ID()) );