Mandatory excerpt for custom post type

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

the_excerpt() is not trimming at

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

Only Show Excerpt After First 3 Posts

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

Remove figcation from excerpt

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’);

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