• 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 link to the XenForo thread in WordPress Theme

The XenScript WordPress - XenForo bridge provides a means to integrate the two projects. Adding a link to the discussion forum in the WordPress child theme may help navigation for visitors.

Step 1: Open content-single.php or equivalent WordPress file
Step 2: Choose the location for the link
Step 3: Add the following

PHP:
<?php global $XF; echo $post->thread_id; ?>

Step 4: Upload the modified file.
Step 5: Test

There are times that WordPress posts are made without a link to XenForo, therefore, wrap the above code in an if statement.

PHP:
<?php if( $post->thread_id != '0' ) { ?>

Example code:

PHP:
    <?php if( $post->thread_id != '0' ) { ?>

       <h2 class="nav-tab-wrapper">
       
        <a href="#1" class="nav-tab nav-tab-active">Article</a>
         
        <a href="http://community.tuxreportsnetwork.com/threads/<?php global $XF; echo $post->thread_id; ?>" class="nav-tab">Discussions</a>
       
       </h2>
     
     <?php } else { global $XF;} ?>

Screen Shot 2013-07-23 at 8.04.47 AM.png
Author
LPH
Views
520
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from LPH

Top