-1
votes
3answers
36 views

How to get post or page excerpt using post_excerpt

I am using the following foreach loop: $pages = get_pages(array ('post_type' => 'page','sort_column' => 'menu_order',)); foreach ($pages as $page) { $apage = $page->post_name; ...
0
votes
1answer
27 views

Excerpt filter is adding '</p>' in incorrect place

I'm using the following code from this question in order to limit the excerpt length to 2 paragraphs. if ( ! function_exists( 'wpse0001_custom_wp_trim_excerpt' ) ) : function ...
0
votes
0answers
21 views

Strip 'p' tags in wp_trim_excerpt()

When I have a lot of paragraphs in a post and trying to display an excerpt in blockquote, all <p> tags are stripped, and whole 55 words are in one <p> tag. <blockquote cite="URL"> ...
0
votes
1answer
31 views

Why the_excerpt() function returns excerpt on the Home page and trimmed content in sidebar?

I have this code to display 4 posts of type "testimonial" on the Home page: <?php $custom_posts = get_posts([ 'numberposts' => 4, 'post_type' => ...
0
votes
1answer
65 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
0answers
9 views

Woothemes Canvas - Variable Excerpt Length [duplicate]

I'm working with WooThemes Canvas - and using a child theme, and I'd like two different post excerpt lengths on the home page. The Featured Post is to have a longer excerpt, and the rest on the grid ...
0
votes
1answer
79 views

Custom excerpt showing first paragraph (with HTML formatting)

Can somebody help me how to show the full first paragraph of the post, including all used tags (no stripping)? My code: function new_excerpt_more() { global $post; return '…</p><div ...
0
votes
1answer
14 views

Edit the excerpt before it is shown

I'm looking for a way the edit the excerpt before it get's show on the page. The issue is this: We import data (jobs) for a third party provider and the content is divided in sections with each a ...
0
votes
1answer
289 views

How to get the post excerpt using post object?

I'm trying to show post excerpt as in navigation. I'm trying this in plugin, does it make any sense? i don't know. I used $nex_obj = get_adjacent_post(false, '', true); for next post and it returns ...
0
votes
1answer
101 views

the_excerpt() does not work with has_excerpt()?

I'm trying to shorten the excerpt but it does not work. It shows the full excerpt which I write in the post edit! I've added this to the functions.php function custom_excerpt_length( $length ) { ...
0
votes
1answer
506 views

How to get excerpt of the recent posts

Right now, i am using code below to show title and its link of recent posts from my custom post category, but for one of my category i want to show excerpt, how can i achieve that. CODE i am using to ...
0
votes
1answer
166 views

Unable to change the “Read more” text inside the_excerpt

I am unable to change the "Read more" text while using the excerpt. I've tried the following code: function new_excerpt_more( $more ) { return ' <a class="read-more" href="'. get_permalink( ...
0
votes
1answer
151 views

Can't change excerpt length and more tag

I tried to change the excerpt length and the more tag the way it is described in the codex: function custom_excerpt_length( $length ) { return 10; } add_filter( 'excerpt_length', ...
0
votes
2answers
57 views

Exclude uploaded files from appearing in the excerpt()

In a post I have some text and some media attachments and when I use the_excerpt(), it strips all the anchor tags from the attachments and shows just their file names and its causing me problems as ...
0
votes
2answers
70 views

the_excerpt not displaying

I have a loop where I display all posts on the site, the problem is that the_excerpt is not being displayed. What am I doing wrong? <?php $all_posts = get_posts(array('numberposts' => ...
0
votes
1answer
419 views

get_the_excerpt() with fallback like the_excerpt()

You know when using the_excerpt() and no "excerpt" is set on a post it automatically uses the first 50 words or so. Is the same also possible when using get_the_excerpt() For instance I'm using ...
0
votes
2answers
562 views

How to add an excerpt and read more link to a page?

I've a custom/static "homepage.php" in my templates directory at my WordPress. Now I need to show differents "page excerpts" in my homepage, but I don't know what should be do it. At this moment I've ...
0
votes
2answers
3k views

Customizing get_the_excerpt() to specific length and “Read More” output.

I am costuming a template. There is a list grabbing the introduction from the first 1-2 paragraphs (all the articles from a category). If I set the excerpt to 295 words, sometimes the list grabs ...
1
vote
1answer
103 views

Give “Read More” precedence over excerpt() word count

By default, the_excerpt() displays the content before the <!--more-->, trimming it at ~50 words. Is there any way to prevent this trimming functionality when the <!--more--> is present, ...
2
votes
3answers
695 views

excerpt in characters

I have code in functions.php: function string_limit_words($string, $word_limit) { $words = explode(' ', $string, ($word_limit + 1)); if(count($words) > $word_limit) array_pop($words); ...
4
votes
2answers
413 views

How to get the unfiltered excerpt, without […] or auto-excerpting

The standard way of getting an excerpt is to use the_excerpt() or get_the_excerpt() template tags. I am trying to get just the actual content of the Excerpt field. If there is an excerpt, I want to ...
8
votes
2answers
469 views

Compare the_excerpt() to the_content()

Is there a way to compare the_excerpt() to the_content() to know if the_excerpt() is actually showing the entire post content? for instance, if a post were particularly short. ultimately i'd like to ...
0
votes
1answer
67 views

Prevent Advanced Excerpt from Being Called

I have excerpts enabled for pages. In one of my page templates I want to prevent <?php the_excerpt(); ?> from initiating the Advanced Excerpt Function. Basically, I have one page template where ...
0
votes
3answers
608 views

Remove Text within Header tags in the Excerpt

With the default WordPress Excerpt function. WordPress strips the header tags (e.g. h1 tag) but keeps the unformatted text, that lies within the opening/closing of the h1 tag, displayed as part of the ...
0
votes
1answer
127 views

Reblog WordPress to another WordPress?

1.Is there any way to reblog only the excerpts of WordPress posts to another WordPress with the featured image(option to choose the size of the image we prefer) and link to the WordPress site to see ...
0
votes
2answers
537 views

Wordpress Excerpt Paragraph Limiting

I was wondering if it was possible to get the first two paragraphs and the feature image in the excerpt. I currently have the first 100 words, but would like the the first two paragraphs. What I ...
0
votes
1answer
55 views

What's the internal concatenation function for creating Excerpts with Wordpress?

I'm already familiar with the_excerpt() and get_the_excerpt() functions. These two functions relate specifically to some node/taxonomy/whatever (post, page, custom post type) inside of Wordpress, ...
1
vote
2answers
234 views

Disabling automatic teasers

I have a custom theme that displays the excerpt: $data = get_the_excerpt(); if ($data) echo "<div class='excerpt'>$data</div>"; if nothing is entered in the excerpt field in ...
1
vote
3answers
3k views

Display Links in Excerpts?

I'm having a problem with the_excerpt and can not find the answer anywhere... I simply want to allow links to be clickable when they are displayed via the_excerpt! There has to be a function for ...
4
votes
5answers
16k views

Get excerpt using get_the_excerpt outside a loop

I have a code that call get_the_title() and it works, but get_the_excerpt() return empty. How can i make it work? This code is inside a plugin called "WP Facebook Open Graph protocol". Here's the ...
0
votes
1answer
320 views

Force WordPress to NOT display the manual excerpt

I'm forced to use manual excerpts on a number of my posts to integrate them with a shortcode plugin. However, this is interfering with how they're being displayed on an archive page (using a page ...
1
vote
1answer
762 views

excerpt - don't use main content if empty

trying to stop get_the_excerpt() from defaulting to the_content() if its empty. this kinda works - well it seems to return 'xxx' so i think has_excerpt() isn't working? function get_link_excerpt(){ ...
0
votes
2answers
122 views

Excerpt Is Disappeared

My theme automatically assign before of <!--more--> tags, as excerpt.And showing excerpt on home page. Now i want to add Google Adsense after <!-- more --> code. I'm wrote this function ...
0
votes
1answer
544 views

Where is the logic that defines the excerpt?

I'm trying to learn HOW to learn about WordPress by following its source code etc. I'm really stumped at the_excerpt(). Documentation states that the_excerpt uses get_the_excerpt(), and will return ...
2
votes
2answers
1k views

How to return the_excerpt (without echo)?

Hey all, I see that get_the_excerpt() echoes the post excerpt if it is manually set, but not if it is automatically generated (with just the 55 words, for example). [and its use is deprecated] ...