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

HowTo: Add XF Discussion Links to bottom of WordPress Blog Post

Place a link to the forum discussion, designed for Multisite

  1. LPH
    Step 1. Open your comments.php file in WordPress child theme.
    Step 2. Add the php code to the bottom of the file.

    PHP:
    1.  
    2. <?php
    3. global $XF;
    4. if (function_exists('xenforo_thread_url')) {
    5.  
    6. if (comments_open() && post_type_supports(get_post_type(), 'comments')) :
    7.   $link = xenforo_thread_url();
    8.   if ($link != '') {
    9.   ?>
    10.   <a class='xf-link' href="<?php echo xenforo_thread_url(); ?>">This story is also in our forums</a></p><br class='clear'>
    11.   <?php
    12.   } else {
    13.   ?>
    14.   <p><?php _e('Comments are closed.', 'twentyeleven'); ?></p>
    15.   <?php } endif;
    16. }
    17. ?>
    18.  
    Instead of $XF->createLink the $link was hard coded to /community/threads/. This makes sure that the domain name is not included in the link.

Recent Updates

  1. Fixed Instructions