How do I add a small excerpt of a blog post on my Front Page Recent Posts widget?
How do I add a small excerpt of a blog post on my Front Page Recent Posts widget?
How do I add a small excerpt of a blog post on my Front Page Recent Posts widget?
Try getting it in raw form from the DB: global $wpdb; $post_excerpt = $wpdb->get_var( $wpdb->prepare( “SELECT post_excerpt FROM $wpdb->posts WHERE ID = %d “, $post->ID ) );
I am working with gutenberg blocks, specially a slider block. I wish to show the excerpt content from a custom api to the backend as well as frontend
To strip the <a>…</a> tags from the output from the_excerpt(), you could use the the_excerpt filter and a regular expression search-and-replace. Updated: In response to a comment, I’ve updated the code—the regex specifically—to strip out <a>…</a> and <a><span>…</a></span> constructions. Updated again: In response to another comment, I’ve updated the code to use the get_the_excerpt filter, … Read more
By default, WordPress saves the open/close state of these metaboxes each time you toggle it. This is done via javascript, requesting an ajax endpoint on the server. You need to find out if that request is still send or not. If it’s not send (e.g. javascript error, blocked by some plugin), then you found the … Read more
If you did not set an explicit excerpt for your post in the post editor, WordPress by default calls wp_trim_excerpt() to auto-generate an excerpt. This function throws out all HTML tags to make life simple. the_content() does not do this when it splits your post on a <!–more–> tag. If you don’t want this default … Read more
I don’t know what you mean by “call images”, but this will display the title as a link. if ( has_post_format( ‘video’ )) { ?><a href=”https://wordpress.stackexchange.com/questions/21333/<?php the_permalink(); ?>”><?php the_title(); ?></a><?php the_excerpt(); }
There is a plugin called FeedWordpress that does just that. It will appear as Syndication in your admin panel. The Posts & Links configuration panel of Syndication will control where the post title links to. The original source is an option.
Are you sure you have replaced it in the correct template file? I found a useful way to tell by adding this to the functions.php file: <?php add_action( ‘wp_head’, ‘adminbar_print_template’ ); function adminbar_print_template() { global $template, $current_user, $wp_admin_bar; get_currentuserinfo(); /* If you have more than one user deny. Be sure to use your user ID! … Read more
Truncate the_content to your desired length, check if the last character is a < and remove it if so, then pass it to force_balance_tags, which will close any opened html tags.