• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.
Resource icon

HowTo: Trim WP Posts in XF to Avoid Duplicate Content

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:
            $body = $XF->visitor->get('username') . ' submitted a new blog post:';
   
            $body .= "\n\n[URL='" . get_permalink($post->ID) . "']" . $title . "[/url]\n\n";
   
            $body .= '[quote]' . XenForo_Helper_String::wholeWordTrim(XenForo_Helper_String::autoLinkBbCode(XenForo_Html_Renderer_BbCode::renderFromHtml(nl2br($content))), 500) . '[/quote]';

Changelog
First modification of XenScripts
Alternative Discussions
XenScripts Discussion
Author
LPH
Views
825
First release
Last update
Rating
5.00 star(s) 1 ratings

More resources from LPH

Latest reviews

This version is much cleaner and looks like the resource manager postings in XenForo. Great job LPH
Top