Support

Account

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

  • Hi James, I got it working with the GET variable.

    Here is my data.php code.

    <?php
        require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-load.php');
        $post_ID = $_GET['id'];
    
        $custom = get_post_custom($post_ID);
    
        foreach ($custom as $key => $value) {
            if (($key != '_edit_lock' && $key != '_edit_last'))
                echo '<tr><td>' . $key . '</td><td>' . $value[0] . '</td></tr>';
        }
    ?>

    Can you please explain me a little more that how can i add single custom field using the_field after closing php tags like that

    <?php
        require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-load.php');
        $post_ID = $_GET['id'];
    
        $custom = get_post_custom($post_ID);
    
        foreach ($custom as $key => $value) {
            if (($key != '_edit_lock' && $key != '_edit_last'))
                echo '<tr><td>' . $key . '</td><td>' . $value[0] . '</td></tr>';
        }
    ?>
                        <span class="aps-1co"> <?php the_field('device_type'); ?> </span>
                        <span class="aps-1co"> <?php the_field('data1'); ?> </span>
    

    Do i need a closing php tags again? because the_field is not working and the upper php section is working.