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
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
Step 1: Create a file named xf-thread-link.php
Step 2: Add the following code to the file
PHP:
<?php
/**
* 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>';
}
endif;
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
PHP:
require_once( 'include/xf-thread-link.php' );