Support

Account

Home Forums Front-end Issues get value for custom filed for single to post type

Solving

get value for custom filed for single to post type

  • Hi

    I have post type that call product and i make for each single to product post type
    4 custom filed [prefe, discount, availability, more details]

    How can i get those value in single page for post type
    and how can i get them also in different page like home page for ex.

  • In your template file for the single product (possibly single-product.php) you can use get_field() to get your field data.

    
    <?php echo get_field( 'discount' ); ?>
    

    If on another page you’ll also need to pass in the post ID. So if you’re on the homepage you’ll need to pass the product ID that you’d like to get the value for:

    
    <?php echo get_field( 'discount', $product_id ); ?>
    
  • Ok thanks i’ll try,

    Could you tell me How can i echo Google map input ?

  • Yep, so there’s a couple pieces involved with displaying the map. Full code/instructions can be viewed at: http://www.advancedcustomfields.com/resources/google-map/#code-examples

  • Thanks ractoon

    I did all the instruction
    but isn’t get the right valid that entered from the backend

    for the first load, it’s render the valid address but quickly return the wrong address

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘get value for custom filed for single to post type’ is closed to new replies.