Giving the_excerpt in the place of the_content?

All good examples. But they weren’t working for me with the theme (pinboard) and plugin I was using (secondary-html-content) and what I wanted to do. The first challenge was to make sure that I get both pieces of content instead of just one. The second challenge was to replace the excerpt on the homepage with … Read more

Limit the size of the post excerpt

Try to go in a completely different way about that and this code to your functions.php // Variable excerpt length. function dynamic_excerpt($length) { // Variable excerpt length. Length is set in characters global $post; $text = $post->post_excerpt; if ( ” == $text ) { $text = get_the_content(”); $text = apply_filters(‘the_content’, $text); $text = str_replace(‘]]>’, ‘]]>’, … Read more

Two “the_excerpt” questions

You need to hook into two WordPress filters. function custom_excerpt_length( $length ) { return 20; } add_filter( ‘excerpt_length’, ‘custom_excerpt_length’, 999 ); http://codex.wordpress.org/Plugin_API/Filter_Reference/excerpt_length function custom_excerpt_more( $more ) { return ‘[…..]’; } add_filter( ‘excerpt_more’, ‘custom_excerpt_more’ ); http://codex.wordpress.org/Plugin_API/Filter_Reference/excerpt_more

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); // the rest of your function

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 examples.

Unable to change the “Read more” text inside the_excerpt

Try making the post object accessible using global and use get_permalink($post->ID) function new_excerpt_more( $more ) { global $post; return ‘<a class=”read-more” href=”‘. get_permalink($post->ID) . ‘”>Custom text</a>’; } add_filter( ‘excerpt_more’, ‘new_excerpt_more’ ); Ensure the code is in your functions.php file.

How to get excerpt of the recent posts

You can use the wp_trim_excerpt() to get the excerpt of the content. You can use it inside your loop to get the excerpt of each post the string provided to a maximum of 55 words if it is more then a […] will be added to the end of the string. <?php $recent_posts = wp_get_recent_posts(array(‘post_type’=>’jokes’)); … Read more

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