1. NEW YEAR SALE Be a Pro Member @ $99 / lifetime & access all our 16+ premium Divi extensions: Divi Block Pro, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed.Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color.
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Adding a Price

Discussion in 'Free Divi Community Forum' started by chriz122, Jul 3, 2024.

  1. chriz122

    chriz122 New Member

    Hi, i have ACF installed and try to get the function to get a Price shown under the Divi Blog Module Title.
    I have the ACF Field "price" and this code into the blog.php in my child theme but its not working
    Code:
    Log In or Sign Up to view this code.

    thank you <3
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade mega menu design for your Divi site without using any plugins:View Demo
  2. Divi Booster

    Divi Booster Divi Expert

    Hey Chriz122,

    Does the text "Preis:" show up?

    If so, then one possible issue I think could occur is with the get_field() call. By default get_field() returns the field value for the current page / post. In the case of a page containing the blog module this might cause it to return the price value set on the page itself (which is probably not set), rather than picking it up from the posts listed in the blog module. ACF might pick up the correct posts from the blog module loop - I'm not sure off the top of my head - but if not you may need to pass the post id as the second parameter to get_field() - something like this:

    $price = get_field('price', $post_id);

    (you'd need to set $post_id in your code).