Forum has moved to another host, some things may be broken or shaky for a little while
Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages » Excerpts, Read more, Pagination »

Adding shortcode function for excerpts


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
  #1  
Old Aug 9, 2011, 11:14 AM
bswb97
 
150 posts · Aug 2010
I want to use some shortcode functionality on excerpts posted on the home page. I know this can be a bit tricky, but this fellow claims to have figured it out:

http://www.mummey.org/2009/02/wordpr...de-an-excerpt/

Quote:
When displaying the postís excerpt, Wordpress uses a function called the_excerpt(). Here it is in the default sandbox template:

HTML Code:
the_excerpt(''.__('Read More <span class="meta-nav">&raquo;</span>', 'sandbox').'') ;
The problem with the_excerpt is that is echoes the excerpt directly to the screen. In order to return the excerpt value as a string we need to use get_the_excerpt(). Next after checking the shortcode API, I discovered a function that will run all the shortcodes on a given string and return the output as a string, do_shortcode().

So all we need to do now is combine these two functions, and move it into the template:

HTML Code:
echo do_shortcode(get_the_excerpt());
And there it is!
I haven't been able to experiment with this too much because I wanted to know WHERE to place this before I potentially had to revert to backup files. He's saying move it into the template -- does that mean a Body HTML insert? Or should I write it directly into the index.php file, and if so, where?
  #2  
Old Aug 9, 2011, 11:27 AM
juggledad's Avatar
juggledad
 
22,151 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
Actually you will have to look in bfa_post_parts.php and note that there are several ways that you can get an excerpt
__________________
Give a person a solution, you fix one issue, teach a person how to solve their problem you enable them forever.
Juggledad | Forum Moderator/Support

Bookmarks

Tags
shortcode excertps

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to get shortcode working in the sidebar... Velma Plugins & Atahualpa 7 Sep 28, 2012 08:05 AM
Adding php or function inside content Miak Post-Kicker, -Byline & -Footer 0 Sep 7, 2009 06:50 AM
Adding shortcode in custom template paulae Plugins & Atahualpa 1 May 21, 2009 04:20 PM
How do I enter shortcode? LemBook Sidebars & Widgets 8 May 17, 2009 06:40 PM


All times are GMT -6. The time now is 10:55 PM.


Powered by vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.