Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

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

Bug: Excerpts in Atahualpa


  #1  
Old Mar 26, 2010, 10:47 PM
nightware
 
1 posts · Mar 2010
Hi Guys, I just discovered a bug, that was teasing me in the Atahualpa 3.4.6 Theme.
When using excerpts on a Archive or Category page, the last Word of the excerpt is dropped.

This is due to an error in the functions.php.
Instead of
PHP 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'); 
it should be
PHP Code:
// Custom Excerpts 
function bfa_wp_trim_excerpt($text) { // Fakes an excerpt if needed
    
    
global $bfa_ata;

    
$excerpt_length $bfa_ata['excerpt_length'];
    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']);
        
$words explode(' '$text$excerpt_length 1);
        
$add_read_more = (count($words) > $excerpt_length);
    } else {
        
$words explode(' '$text);
        
$add_read_more true;
    }


    if (
$add_read_more) {    
        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'); 
starting from line 268.

But I do not like the behaviour to not print a link to the original article. Thus I replaced
PHP Code:
$add_read_more = (count($words) > $excerpt_length); 
by
PHP Code:
$add_read_more true
I think there should be an option to print the link to the original article even when the complete text has been printed on the excerpt page, because for example images will be left out on excerpts.

Cheers,
nightware
  #2  
Old May 3, 2010, 06:12 AM
Fux
 
142 posts · Apr 2009
Yeah, the dropping-the-last-word-bug is really annoying. Will this be fixed in the next version?
  #3  
Old May 17, 2010, 10:09 AM
babspace
 
1 posts · May 2010
Thank you!!!!!

I've been going slightly batty trying to figure out why all of my manual excerpts were of random (shortened) lengths. It didn't dawn on me, until now, that they were all missing the last word.

I've popped your code in and all is well.

Thanks again!

Bookmarks

Tags
atahualpa 3.4.6, bug, excerpt

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible bug in Atahualpa paulae Atahualpa 3 Wordpress theme 12 May 10, 2010 05:04 AM
Atahualpa 3.4.2 bug - html entities instead of UTF8 chars in meta fields pgc Atahualpa 3 Wordpress theme 5 Aug 13, 2009 09:14 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
Bug? Atahualpa 3.3.3 Theme Options > Category Menu Bar Deahna Page & Category Menu Bars 5 Jun 1, 2009 08:46 PM
Bug: Atahualpa 3.0 Theme Options > Page Menu Bar bseppa Page & Category Menu Bars 5 May 9, 2009 08:59 PM


All times are GMT -6. The time now is 07:53 AM.


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