How to extract an excerpt from a specific page?
you need to use get_the_excerpt https://codex.wordpress.org/Function_Reference/get_the_excerpt Where the argument can be the page id or the post object you want to get the excerpt from.
you need to use get_the_excerpt https://codex.wordpress.org/Function_Reference/get_the_excerpt Where the argument can be the page id or the post object you want to get the excerpt from.
So the answer depends on what you mean by “when the category is 429”. This could mean either: You are currently viewing the archive for category 429, and want this to be added to any posts that are listed. You are currently viewing the blog, date archive, or search results, and want to add this … Read more
The code adds a filter to wp_insert_post_data: add_filter(‘wp_insert_post_data’, ‘mandatory_excerpt’); And here’s the callback: function mandatory_excerpt($data) { $excerpt = $data[‘post_excerpt’]; if (empty($excerpt)) { if ($data[‘post_status’] === ‘publish’) { add_filter(‘redirect_post_location’, ‘excerpt_error_message_redirect’, ’99’); } $data[‘post_status’] = ‘draft’; } return $data; } The filter callback is passed $data, which as per the Codex includes the following post data: ‘post_author’, … Read more
There are several options you have. You can write your own excerpt, or just use the tools which WordPress offers to you. There are three options you have: Use WordPress core function the_excerpt(); Use WordPress core function get_the_excerpt(); Use WordPress filter wp_trim_excerpt(); The easiest and propably most fitting for you is the first one. <?php … Read more
get_the_excerpt only returns one excerpt
the_excerpt() does not recognise or support the <!– more –> tag. From the documentation: The <!–more–> quicktag requires templates to use the_content() whereas using excerpts requires, and allows, template writers to explicitly choose whether to display full posts (using the_content()) or excerpts (using the_excerpt()). The point is that the_excerpt() allows theme authors (you) to require … Read more
You could add a count variable and count how many times the page has looped and only show the excerpt if the count is 3 or greater.: <?php $Count = 0; ?> <div class=”content-block-archive”> <div class=”content-block-archive-thumbnail”> <a href=”https://wordpress.stackexchange.com/questions/343700/<?php the_permalink(); ?>”><?php echo get_the_post_thumbnail($post_id, ‘large’, array(‘class’ => ‘alignleft’)); ?></a> </div> <div class=”content-block-archive-meta”> <h2 class=”content-block-archive-title”><a href=”https://wordpress.stackexchange.com/questions/343700/<?php the_permalink(); ?>”><?php … Read more
Relia Theme Homepage Articles Excerpt displays the current page excerpt not the posts being pulled
Use directly in the templates. echo strip_shortcodes( get_the_excerpt() ); how does it work as follows ? add_filter(‘the_excerpt’, ‘strip_shortcodes’); or add_filter(‘get_the_excerpt’, ‘strip_shortcodes’);
Auto generate excerpt from ACF field on a CPT that does not support excerpt or content