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 » New Versions, & Updating » Old Version fixes and change logs »

[SOLVED] [BUGFIX 3.4.1->3.4.6] Getting Configure Excerpts to work in all cases


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

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
 
Prev Previous Post   Next Post Next
  #1  
Old Sep 10, 2009, 07:08 PM
juggledad's Avatar
juggledad
 
22,263 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
[SOLVED] [BUGFIX 3.4.1->3.4.6] Getting Configure Excerpts to work in all cases

There are two ways to have excerpts using Atahualpa (1) Add an excerpt in the post (dashboard->Posts->Edit->Excerpt) or (2) have Atahualpa create one using the first X number of words in the post (ATO->Configure EXCERPTS->Excerpt length)

When you use method (2) Atahualpa will follow the excerpt with ATO->Configure EXCERPTS->Custom read more, but with option (1) it will not.

the following patch will allow the 'Custom read more' to show up in both cases.

Edit functions.php and locate the following code
in 3.4.1 it should be lines 243-266
in 3.4.2 it should be lines 250-273
HTML Code:
// Custom Excerpts 
function bfa_wp_trim_excerpt($text) { // Fakes an excerpt if needed
	
	global $bfa_ata;
	
	if ( '' == $text ) {
		$text = get_the_content('');
		$text = apply_filters('the_content', $text);
		$text = str_replace(']]>', ']]>', $text);
		$text = strip_tags($text, $bfa_ata['dont_strip_excerpts']);
		$excerpt_length = $bfa_ata['excerpt_length'];
		$words = explode(' ', $text, $excerpt_length + 1);
		if (count($words) > $excerpt_length) {
			array_pop($words);	
			$custom_read_more = str_replace('%permalink%', get_permalink(), $bfa_ata['custom_read_more']);
			$custom_read_more = str_replace('%title%', the_title('','',FALSE), $custom_read_more);
			array_push($words, $custom_read_more);
			$text = implode(' ', $words);
		}
	}
	return $text;
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'bfa_wp_trim_excerpt');
Replace that code with the following
HTML Code:
// Custom Excerpts 
function bfa_wp_trim_excerpt($text) { // Fakes an excerpt if needed
	
	global $bfa_ata;

	if ( '' == $text ) {
		$text = get_the_content('');
		$text = apply_filters('the_content', $text);
		$text = str_replace(']]>', ']]>', $text);
		$text = strip_tags($text, $bfa_ata['dont_strip_excerpts']);
		$excerpt_length = $bfa_ata['excerpt_length'];
		$words = explode(' ', $text, $excerpt_length + 1);
	} else {
		$words = explode(' ', $text);
	}

	if (count($words) > $excerpt_length) {	
		array_pop($words);	
		$custom_read_more = str_replace('%permalink%', get_permalink(), $bfa_ata['custom_read_more']);
		$custom_read_more = str_replace('%title%', the_title('','',FALSE), $custom_read_more);
		array_push($words, $custom_read_more);
		$text = implode(' ', $words);
	}

	return $text;
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'bfa_wp_trim_excerpt');
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Can't configure theme options - I can only Reset ALL! AndrewSw New Versions, & Updating 7 Nov 4, 2009 01:13 PM
[SOLVED] I want to configure my WordPress blog. Xarzu Installing & running WordPress 3 Oct 27, 2009 04:50 AM
Atahualpa 3.4 : EXCERPTS new option to read the full post after [...] does not work benoit Excerpts, Read more, Pagination 2 Jul 9, 2009 06:45 PM
Excerpts on home page don't work kennfusion Excerpts, Read more, Pagination 1 Jun 7, 2009 10:22 AM
[SOLVED] Excerpts on home page don't work juggledad Excerpts, Read more, Pagination 1 May 31, 2009 06:14 PM


All times are GMT -6. The time now is 04:11 AM.


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