pastorjacklamb / sermon-manager-for-wordpress

A WordPress plugin to allow churches to publish audio & video sermons
6 stars 5 forks source link

Duplicate content bug #3

Closed killnine closed 11 years ago

killnine commented 11 years ago

Found an issue when using RS Events Multiday (http://wordpress.org/extend/plugins/rs-event-multiday/) with this plug-in.

Both have calls to add_filter('the_content', '<some callback here>'); , which causes (in this case) SM to render things twice on some pages. I think this also may be an issue with JetPack as well (which will definitely be a deal-breaker for some people).

The conflict exists in rs_event_list_return($args = array()) function in RS Events, and in the add_wpfc_sermon_content($content) function of this plugin. I don't know much about PHP or WP, unfortunately so this was my hack:

$counter = 0;
add_filter('the_content', 'add_wpfc_sermon_content');
function add_wpfc_sermon_content($content) {
global $counter;
if ( 'wpfc_sermon' == get_post_type() && $counter < 1 ){
    if ( is_archive() ) {
        $new_content = render_wpfc_sermon_excerpt();
    } else {
        $new_content = render_wpfc_sermon_single();
    }
    $content = $new_content;    
}   
$counter = $counter + 1;
return $content;
}

It is a shameless grab of this: http://pastebin.com/0cwd150Z, but I had to change the comparison operator from equals to strictly less-than

Great plug-in, otherwise. Just has a few kinks with two of the plug-ins I want to use :(

pastorjacklamb commented 11 years ago

I just updated the main sermons.php file with a fix for this. Can you update your install with it and let me know if it works for you? If it does, then I'll push the changes to the wordpress.org repository.

pastorjacklamb commented 11 years ago

I just updated it again. That was my mistake pushing a change without testing it! Let me know how it goes.

killnine commented 11 years ago

I FINALLY got back to this project and, yes, this looks to have resolved the bug with stuff appearing at the top (bug with Jetpack and RS Events). However, in the Archive page, it looks like my MP3 lessons are showing up under the RS Event widget's Upcoming Events. Ill keep investigating and put in another bug if I can track it down.

pastorjacklamb commented 11 years ago

Development has moved to bitbucket: https://bitbucket.org/wpforchurch/sermon-manager-for-wordpress