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

HOWTO: Add a custom post in admin panel for XF Thread ID

Add a new column to show the XenForo thread ID next to the WordPress post

  1. LPH
    Integrating XenForo and WordPress requires more than just a means to create a XenForo thread from a WordPress post, it requires easier maintenance too. The following code will help an administrator see the thread tied to a WordPress post.

    Add the following WordPress actions to the theme's function.php file:

    PHP:
    1.  
    2. add_filter( 'manage_posts_columns', 'add_thread_id' );
    3. function add_thread_id($columns) {
    4.    $columns['threads'] = 'Threads';
    5.    return $columns;
    6. }
    7.  
    8. add_action( 'manage_posts_custom_column', 'xf_show_columns' );
    9. function xf_show_columns($name) {
    10.    global $XF, $post;
    11.    switch ($name) {
    12.      case 'threads' :
    13.        $threads = $XF->getThreadIdForPost($post_id);
    14.        echo $threads;
    15.    }
    16. }
    17.  
    XenForo WordPress Integration WP Post Admin Panel.png