• 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: Add a dynamic link to the XenForo thread in a WordPress Post

The XenScripts PHP files allow a WordPress post to be placed in the XenForo forum with a link back to the WP post. However, getting a link into the WordPress theme requires adding code to the theme. The following addition to the plugin makes this no longer necessary.

Step 1: Create a file named xf-thread-link.php

Step 2: Add the following code to the file

* Creates a link to the XenForo thread below the content in WordPress post

add_filter('the_content', 'show_thread_id');

if ( !function_exists('show_thread_id') ) :

function show_thread_id($content) {
   global $XF, $wpdb;
     echo $content;
     echo '<br /><a href=" ' .  $XF->createLink($link) . 'threads/' . $XF->getThreadIdForPost($post_id) . '">Our Community</a>' ;
     echo '<hr>';


Step 3: Upload the file to the plugin directory. I prefer the plugin/include directory. Make note so you can include the location into the xf_integration.php file.

Step 4: Add the following code to the xf_integration.php file

require_once( 'include/xf-thread-link.php' );
First release
Last update
0.00 star(s) 0 ratings

More resources from LPH