Questions tagged [excerpt]

Excerpts are short texts or summaries

Filter by
Sorted by
Tagged with
0 votes
1 answer
2k views

How to force wp excerpt to use br tag?

wp editor was replacing br tag with p tag. not all the solutions here worked. It was causing problem with design. So i disabled wpautop with below code.... remove_filter( 'the_content', 'wpautop' ); ...
0 votes
2 answers
856 views

the_excerpt() doesn't return the Excerpt field content

The problem I'm having is that the_excerpt() isn't returning the content from the post's "Excerpt" field. Instead, it's returning the first 55 words of the post, as though the "Excerpt" field is empty....
0 votes
1 answer
771 views

Limit article to 100 characters. Can't use the_excerpt...

I've been struggling with this for a long time... I want to limit article lenght to 100 characters and after 100 char. limit, add at the end '...' linked to a single post (like wordpress's <!--more-...
1 vote
2 answers
1k views

the_post() within switch_to_blog() altering my excerpt

I have a strange problem I'm facing when using WP_Query with multisite in a plugin I'm writing which hooks into add_meta_boxes. I'm wanting to display all post titles in a dropdown in a meta box. ...
1 vote
6 answers
6k views

Remove &nbsp from the_excerpt

Wordpress is creating a &nbsp in the_excerpt. How do I remove it? <div class="subtitulo-noticia"><?php the_excerpt(); ?></div> &nbsp creates a space at the beginning of p ...
0 votes
0 answers
14 views

How to share to Facebook as an excerpt?

Doesn't have to be automated. It's just every instruction I read says to just paste a link and wait a fee seconds. For me it doesn't work. It always shows the main page image, instead that of an ...
0 votes
1 answer
1k views

Remove Default Read More Link in Manual Excerpt RSS Feed

I have a site that displays manual excerpts on the blog post page: https://teralynnchilds.com/blog. I added a custom read more link using the snippet found here: https://wpmayor.com/add-read-link-...
0 votes
1 answer
43 views

Only show read more text when when wp:post-excerpt meets excerptLength

NOTE: The issue I'm encountering is specific to Block Themes; I understand how to filter the text returned from the_excerpt in a Classic Theme. What I would like to only show read more text when when ...
0 votes
1 answer
1k views

Custom CSS for full post vs. excerpt (Content Options)

Is there a way activate "Full Post" via Custom CSS or any other way? Right now I am stuck with Excerpts on the Homepage and my Theme Customizer > is missing Content Options Here below is what my ...
1 vote
1 answer
3k views

Retrieving post excerpt as a shortcode

How do I register a shortcode to add the manual post excerpt anywhere within the same post? Does this shortcode already exist in WP? Thanks!
0 votes
1 answer
29 views

Fix count of lines of excerpt block (or any block)

I have a need for the Power Query's nested excerpt block to be a fixed height, which means it is 2 lines tall, whether the excerpt text is 1 line or 3 lines. Is it possible to fix a block's height? I ...
3 votes
1 answer
2k views

Custom wp_trim_words() function not trimming right

I have this custom wp_trim_words() function set to give me excerpts of only 20 words, and for the most part, it works fine. Except for some reason, on posts that contain lists, it outputs way more ...
0 votes
1 answer
2k views

Enable HTML Tags in Wordpress Post excerpt

i did enyone know how i can enable HTML for the Post excerpt thet i can make some parts of thet big? Sorry for my Bad english and thanks for awnser :)
0 votes
1 answer
775 views

Cutting off excerpt with first sentence

I'm trying to end my excerpts with the first sentence. I had attempted the solutions I found on this website, including each function + add_filter from these posts: How to end the excerpt with a ...
0 votes
2 answers
74 views

Display Rank Math Meta description at the beginning of single post

With this code register_activation_hook( __FILE__, 'rm_to_excerpt' ); function rm_to_excerpt() { $args = array( 'post_type' => 'post' , 'numberposts' => -1 ); $...
1 vote
3 answers
1k views

How to remove first three words from content and display the excerpt

Hi I am making a video game site. I can display the excerpt, shortened it as well after following some advice. What I can't do is remove the first three words from the content and then display it as ...
0 votes
1 answer
1k views

How to strip header tags & shortcodes from the_excerpt()

I'm trying to learn how to strip "header tags" & "shortcodes" from the_excerpt()... Searched for an answer to no avail so thought Id ask the community. Thanks for your time Best Shaun
0 votes
2 answers
695 views

Problem with site's search results "Read More" link?

I'm hoping someone will be able to help me with this issue. I noticed today that when I search certain serch terms in my Wordpress site's search box the link is messed up (shown in the image below ...
0 votes
2 answers
726 views

Check if excerpt is empty at loop-portfolio

I want to check if excerpt is not empty, then echo the excerpt link, if not the echo permalink, like this: if(the_excerpt()!='') echo the_excerpt(); else echo get_permalink() but how can I check if ...
0 votes
1 answer
37 views

hook on the_excerpt

I would like to have the excerpt length formatted + [...] and then keeping the 'read-more' as a button. I was able to hook the 'excerpt_length' from 55 to 25 and that was fine: function ...
0 votes
2 answers
1k views

Manual excerpt being ignored on custom post type

I've set up some custom post types with Pods, but can't seem to get it to display my manual excerpt. It's working fine for my normal posts. I've tried displaying it with echo get_the_excerpt() and ...
0 votes
1 answer
712 views

Filter URL and shortcodes from the_excerpt

I just noticed a weird behavior on a theme I'm working on. If I have a post with just one link or shortcode, the_excerpt will print that URL or shortcode. But if I have some text in the post, below or ...
-1 votes
2 answers
653 views

How to make WordPress orderby work with post_excerpt column?

I can use WordPress in-built orderby to sort playlist by any column except post_excerpt echo wp_playlist_shortcode( array( 'ids' => '7,8,9', '...
0 votes
0 answers
16 views

Excerpt selected content automatically

Hi, as you know, the excerpts will show only a part of the content which always starts at the beginning of the post and ends wherever the character limit is set to. However, I want to show a part of ...
4 votes
4 answers
14k views

excerpt_length not working

I'm trying to build a theme, I want to control the length of the post excerpts by doing something like this in functions.php: function theme_excerpt_length( $length ) { return 45; } add_filter( '...
16 votes
5 answers
9k views

How to end the excerpt with a sentence rather than a word?

Here is the excerpt of the post on my home page. I want to end the excerpt with a sentence. In this case it is ' opportunities. '. I know how to modify the length but it won't do what i want. Here is ...
0 votes
1 answer
1k views

How to Remove HTML Elements from Post Excerpt?

I am Using the Following Code and want to remove HTML All Elements. <?php $exerpttext = substr(get_post_field('post_content', $post->ID), 0, 300); if (!empty($exerpttext)) { echo $exerpttext.'......
0 votes
1 answer
26 views

Strip and print only the numbers found in current's post excerpt (even if they are without space)

I have a working code for printing just the year (number) if found in the current post excerpt, but the problem arises when the number (a year) is followed by a Japanese character (example: '2023年', ...
0 votes
1 answer
42 views

I have issue with decoding json ex. '{"a":"b"}'

Hey I am trying to send JSON data from (WRITE AN EXCERPT (OPTIONAL)) this section. Let say I pass this '{"a":"b"}' as Map now in the wordpress templete I tried to get this so I was ...
12 votes
6 answers
9k views

Move excerpt meta box to above content editor

I found a WordPress hook called "edit_form_after_title" to add a text box after the title. How can I use this hook to display the excerpt after the title while creating a new post?
0 votes
1 answer
394 views

HTML in excerpt Wordpress 6.2.2

A while back (5+ years) I was asked to build a site where there was some HTML needed in the WP excerpt, from what I can remember I achived this by overriding "get_the_excerpt" something like ...
0 votes
1 answer
2k views

WPBakery Page Builder Shortcode Showing On Front Page For Post

I am working on a new site and am having an issue with the WPBakery plugin. I assume its a custom version of WPBakery, since it's marked WPBakery Page Builder by VisualModo, which is who my theme is ...
3 votes
5 answers
6k views

How to Display Post Excerpts in Admin by Default?

By default in the admin the Excerpt is hidden. See below. I would like to make it show up by default.
0 votes
0 answers
32 views

Code in the excerpt of the search page

I am having problems with the search page. In this page I get the title and the excerpt of each page/article in the complete web. In the last page that the search engine places the following appears ...
2 votes
2 answers
2k views

How to display post content instead of excerpt

I am using a plugin, and to get around something I need to add some text to the excerpt field on my posts, but I don't want to display the excerpt field data on the front end, but rather the post ...
0 votes
3 answers
3k views

Highlight search words in excerpt

I have designed and developed a responsive Wordpress site that is almost ready for launch for a client who is an actor and producer. I have been stuck on my requirements for the search results page ...
0 votes
1 answer
159 views

How to fix special characters when the title or excerpt is shortened [closed]

I have this code for the title <?php $thetitle = $post->post_title; $getlength = strlen($thetitle); $thelength = 26; echo substr($thetitle, 0, $thelength); if ($getlength > $thelength) echo &...
0 votes
0 answers
29 views

Format main page post excerpt previews

For my posts, I use a block quote/pull quote at the top of them all to highlight a key sentence that is contained in the body of the post. The only problem is the post excerpts also pull this line in ...
0 votes
0 answers
17 views

Setting post excerpt length in php wordpress code, Should will help to save DB size?

I am trying to optimize wordpress DB. As Google or any other search engine only reads around 300 char of data per blog, It's better to set excerpt length to 300 char. but doing this do we save DB ...
0 votes
1 answer
150 views

Remove automatic excerpts only for single posts

I want to be able to remove automatic excerpts (and keep the custom ones) only on single posts since I make use of automatic excerpts in my archives. I am using this code: if ( is_single() && '...
9 votes
5 answers
41k views

How to remove "read more" link from custom post type excerpt

Is there a way I can add some kind of pre_get_posts() filter to strip out the "read more" link that appears at the end of the_excerpt() for only 1 certain custom post type that I specify? If so, can ...
0 votes
1 answer
729 views

display public excerpt for private post

Thank you in advanced. I know there are plugins that can do this, but I am looking for a simple solution for my function file. I would like to display the excerpt for all posts with the more tag for ...
0 votes
2 answers
2k views

Excerpt Length & List Category Posts Plugin

I'm trying to filter out the excerpt by character length for a plugin called "List Category Posts". I've been trying to get the excerpts working for the past week, but nothing is doing the trick. The ...
2 votes
1 answer
9k views

wp_trim_words is trimming by character instead of by words

I'm using Wordpress 3.9.2, and having trouble with the wp_trim_words function. It seems to be cutting the string down to X characters instead of X words. Example Put the following in a template ...
0 votes
3 answers
593 views

Inserting shortcode is blanking excerpt - any ideas?

I wrapped a shortcode around my post content and I have noticed it is making the excerpt blank on archive pages instead of auto generating one from the_content/post. At a loss as to what is causing it ...
3 votes
1 answer
8k views

add_filter on "the_excerpt" only works when post does not have excerpt

class my_menu extends WP_Widget { function widget($args, $instance) { // Excerpt length filter $new_excerpt_length = create_function('$length', "return " . $...
7 votes
4 answers
17k views

the_excerpt and shortcodes

I'm using the_excerpt on my index page. I'm also using a dropcap shortcode at the beginning of each of my posts. On the index page, the posts will not display the letter with the dropcap shortcode ...
0 votes
1 answer
1k views

run shortcode in excerpt of single custom post type

Hi because of the way my theme is set up, I need to run a shortcode inside the excerpt of a custom post type (services). This is the code I have so far... function do_my_shortcode_in_excerpt($excerpt) ...
0 votes
0 answers
514 views

shortcode doesnt work on excerpt

My shortcodes don't seem on archive page excerpts. You can see an example excerpt: https://unit-test-data.deniz-tasarim.site/2011/03/15/ here is related code with an excerpt in my theme files: ...
66 votes
3 answers
134k views

Allow HTML in excerpt

Here is my excerpt code. // Generate custom excerpt length function wpbx_excerpt_length($length) { return 300; } add_filter('excerpt_length', 'wpbx_excerpt_length'); How do I allow html like <...

1
2 3 4 5
14