Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Excerpts are short texts or summaries
1
vote
Removing the [...] from the excerpt returned by get_the_excerpt() only in some places
Don't use get_the_excerpt. Just do something like:
if (is_singular() && isset($post->post_excerpt)) {
echo '<meta name="description" content="'.esc_attr($post->post_excerpt).'" />';
}
$post is …
1
vote
truncate post with gallery tag
Use strip_shortcodes as well. That should remove the shortcodes from the content.
A couple of notes: Your code seems to be doing some things that I don't understand. For example, you run the the_cont …
3
votes
Accepted
the_excerpt not displaying
You need to be using setup_postdata
foreach($all_posts as $post):
setup_postdata($post);
// the rest of your loop
If you look at the docs for get_posts you will see that in all of the examp …
3
votes
excerpt display same text
You need to be using setup_postdata($post); as in all of the examples for get_posts. You need:
$myposts = get_posts('numberposts=5');
foreach($myposts as $post) :
setup_postdata($post);
// th …
0
votes
Include post title in readmore link?
You can filter the read more link with the the_content_more_link filter.
function the_content_more_link_wpse_100990($more) {
global $post;
$pattern = '|>([^<]+)<|';
return preg_replace($pattern …
3
votes
Accepted
the_excerpt Read More Filter
.
// Changing excerpt more
function new_excerpt_more($post) {
return ' <a class="read_more" href="'. get_permalink($post->ID) . '">' . 'read more' . …
1
vote
Make only the image an anchor link using the advanced excerpt plugin?
To get a link around only part of the excerpt content you will need a filter on get_the_excerpt similar to the following:
function dummy_excerpt_filter($excerpt) {
// manipulate the excerpt
return … $excerpt;
}
add_filter('get_the_excerpt','dummy_excerpt_filter');
The problem with that is that the // manipulate the excerpt part means using regex on your excerpt content, which can be dicey. …
0
votes
Accepted
Excerpt_length nor the_excerpt not working correctly
If you look at that function you'll notice that excerpt_length is only applied when the excerpt is generated from the post body automatically. … Otherwise, the manually written excerpt just passes straight through. …
2
votes
Change excerpt length of first post
Use the current_post property of the WP_Query object:
function new_excerpt_length($length) {
global $wp_query; // assuming you are using the main query
if ( 0 === $wp_query->current_post)
…
11
votes
Accepted
Remove Ellipses from Excerpt
.
// Changing excerpt more
function new_excerpt_more($more) {
global $post;
remove_filter('excerpt_more', 'new_excerpt_more');
return ' <a class="read_more" href="'. get_permalink($post->ID) . …
3
votes
Show read more link next to last word
The only thing that makes sense to me is that $text immediately after this line:
$text = force_balance_tags($out);
Has something that wpautop translates as a paragraph break-- something like a double …
4
votes
Accepted
How to wrap "Read More" link in a DIV tag?
Put a filter on the_content_more_link.
Untested but...
function wrap_more_link($more) {
return '<div>'.$more.'</div>';
}
add_filter('the_content_more_link','wrap_more_link');
4
votes
Accepted
Limit the_excerpt in the first point (.) of the sentence
add_filter(
'the_excerpt',
function ($excerpt) {
return substr($excerpt,0,strpos($excerpt,'.')+1);
}
); …
0
votes
Accepted
the_excerpt() does not work with has_excerpt()?
To trim your manually created excerpt, use the same function that trims the generated one-- wp_trim_words. …
0
votes
Text under post title on frontpage but don't want it in full post
There is a hook called edit_form_after_title that seems built for this case. That plus a custom meta field should do it.
function after_title_cb($post) {
$af = get_post_meta($post->ID,'_after_title …