Support

Account

Home Forums Front-end Issues Displaying a group outside WordPress Loop Reply To: Displaying a group outside WordPress Loop

  • Hi @jazibzaman

    I don’t know which tab plugin did you use and how to use it, so I’m sorry I can’t test it out. Here is my testing code in data.php:

    <?php
    // Include WordPress
    define('WP_USE_THEMES', false);
    require_once('../../../../../wp-load.php');
    
    if ( isset($_GET['postid']) ){
        $post_id = $_GET['postid'];
        $fields = get_fields($post_id);
        echo "<pre>";
        print_r($fields);
        echo "</pre>";
    }
    ?>

    To test it out, you need to open this URL:

    http://example.com/wp-content/themes/your_theme_dir/includes/tabs/data.php?postid=99

    Where “example.com” is your domain, “your_theme_dir” is the directory where you put your current theme and “99” is the post ID that has the custom fields.

    It should show the fields in that post. So, the only thing you need to do is passing the post ID in the tab link.

    I hope this makes sense.