1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

HowTo: Trim WP Posts in XF to Avoid Duplicate Content

Trim WP posts created in XenForo Community to avoid duplication

  1. LPH
    One of the challenges to the XenScripts bridge is avoiding duplicate content, yet getting the readers from the forums to see the complete post. The following code modifies xf_thread_creation_system.php so that the body of the WordPress blog posting is trimmed to 500 words. This avoids the duplication.

    PHP:
    1.             $body = $XF->visitor->get('username') . ' submitted a new blog post:';
    2.    
    3.             $body .= "\n\n[URL='" . get_permalink($post->ID) . "']" . $title . "[/url]\n\n";
    4.    
    5.             $body .= '[quote]' . XenForo_Helper_String::wholeWordTrim(XenForo_Helper_String::autoLinkBbCode(XenForo_Html_Renderer_BbCode::renderFromHtml(nl2br($content))), 500) . '[/quote]';
    6.            
    Changelog
    First modification of XenScripts
    Alternative Discussions
    XenScripts Discussion

Recent Reviews

  1. Albert
    Albert
    5/5,
    This version is much cleaner and looks like the resource manager postings in XenForo. Great job LPH