Forum

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 3 characters - maximum search word length is 84 characters

Topic RSS
need help with a shortcode to trim the sermon description
9 March, 2010
12:24 am
anointed
Guru
Forum Posts: 57
Member Since:
23 August, 2009
Offline

I've been struggling for a couple of days now to get a shortcode for the sermon description set where I can 'trim' the sermon description shortcode.

example:
http://shawngaffney.anointed.n…..t/sermons/

It looks really stupid having the entire sermon text displayed on the archive page. I would much rather have a sermon description much like an excerpt for wordpress.

I have written many 'trim' excerpt functions before for normal wordpress excerpts, but just can't get the hang of doing it with sermon-browser.

Would someone be so kind as to lend a hand?

also:
I've noticed that every page on my test sites loads very fast, except anything doing with sermon-browser. There are only 2 sermons on this dev site, and yet sometimes the load time is so long that the page does not load properly.

Is there any easy way to test to see if there is a stuck db loop somewhere?

thanks

12 March, 2010
4:00 am
anointed
Guru
Forum Posts: 57
Member Since:
23 August, 2009
Offline

bumping this up in hopes that someone can lend a hand.

Many of the sermons have anywhere from 2-10 pages of notes with them, and as it's displaying the entire description, it's starting to look really stupid.

@Mark – do you have a few mins to code up a trimming function for this?

(I know wp3.0 is going to radically change things, but unfortunately for me I can't wait for 3.0 on the current project. I tried using 3.0alpha but it's truly alpha still and nowhere near production ready)

btw
tracked down the slowness issues. I had way to much loading into the archive template via js. Was not an issue with sb

18 March, 2010
8:39 pm
anointed
Guru
Forum Posts: 57
Member Since:
23 August, 2009
Offline

trying one more time to see if I can get some help with this.

Here is an example of the code I use to trim the_content on my homepage. I am looking for something similar to trim the sermon description.

/*this function allows for the auto-creation of post excerpts*/
function truncate_post($amount,$quote_after=false) {
$truncate = get_the_content();
$truncate = apply_filters('the_content', $truncate);
$truncate = preg_replace('@<script[^>]*?>.*?</script>@si', '', $truncate);
$truncate = preg_replace('@<style[^>]*?>.*?</style>@si', '', $truncate);
$truncate = strip_tags($truncate);
$truncate = substr($truncate, 0, strrpos(substr($truncate, 0, $amount), ' '));
echo $truncate;
echo "…";
if ($quote_after) echo('"');
}

I then simply call it in my template like:

<?php truncate_post(305); ?>

please help

Forum Timezone: Europe/London

Most Users Ever Online: 40

Currently Online:
13 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

malpan: 2453

jogen: 2440

VanWatterson: 652

GeraldSebring: 364

LucasWoltman: 362

RandellFeenstra: 362

Member Stats:

Guest Posters: 7

Members: 2062

Moderators: 1

Admins: 1

Forum Stats:

Groups: 1

Forums: 2

Topics: 1071

Posts: 4042

Newest Members: richdorm, Aaron Velasquez, aaronv, dave5884, tomduckering, ccwebb

Moderators: Ben Miller (386)

Administrators: Mark Barnes (425)

Comments are closed.