Añadiendo este código PHP a su tema wordpress le permitirá mostrar el extracto del post fuera del bucle.
<?php global $post; if (is_single()) { echo get_the_excerpt($post->ID); } ?>
Añadiendo este código PHP a su tema wordpress le permitirá mostrar el extracto del post fuera del bucle.
<?php global $post; if (is_single()) { echo get_the_excerpt($post->ID); } ?>
I’m not sure, how do I use this and can it be used on wordpress pages?
Hi Laurize, Lets say you wanted to display the excerpt of a post but within the footer of the page. Normally you would need to have the_excerpt within the loop this would let you place it in any location including the side bar footer etc.
That’s what I need. but how do I use it? do i just replace the ‘ID’?
Nope it will get the ID of the post it is displayed on so just place it within the sidebar or the header footer etc.
I wish it were that simple — it would be wonderful! Sadly, the usage of get_the_excerpt() with a parameter has been deprecated: look at http://core.trac.wordpress.org/browser/tags/3.2/wp-includes/post-template.php line 261 and following.
The Codex also flags this usage as deprecated.
This doesn’t work.
Just tested the snippet to make sure I had no errors and it works fine. Can you give me some details on the what you are doing with the snippet ?