an
groups-icon

Accessing $post global variable in content-single-listing-auction.php

Wait a minute... This content is very very old. We no longer sell or support this theme version. New Topics
  • Version 9
    Aleksei Kuzmin
    0 points
    Beginner

    Does anyone know, why I can’t access the $post variable in content-single-listing-auction.php?
    It works perfectly in content-listing-auction.php, but not in this file.

    The thing I want to accomplish is to pick a current price in content-single-listing-auction.php and echo it, so I could pick it with xmlhttpRequest every second and autorefresh it on my listing page.

    Something like this:

    require($_SERVER[‘DOCUMENT_ROOT’].’/wp-load.php’);
    global $post;
    $price_current = get_post_meta($post->ID,’price_current’,true);
    echo $price_current;

    But if I try var_dump($post);

    It returns NULL.

    September 27, 2017 at 8:12 am
  • James D
    0 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    September 27, 2017 at 9:29 pm
  • James D
    0 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    September 27, 2017 at 11:22 pm

289

Views

2

Replies