Support

Account

Home Forums General Issues ACF warning messages appear in frontend Reply To: ACF warning messages appear in frontend

  • Hi John, and many thanks.

    Re: custom PHP code, I do have 3 tiny PHP files sitting in my child theme’s includes directory, each of which interrogates an ACF field, and based on the status of that field, returns a different value to the shortcode on the product webpage. The code these 3 files contain is simply this:

    <?php function ph_isSold_shortcode( $atts ) 
    {
    	/*$status = get_field('field_5fbfa6ddbe952');//the Sold? checkbox */
    	$status = get_field('sold_status');
     
    	if ($status)
    		return $status;
    }
    
    add_shortcode( 'soldornot', 'ph_isSold_shortcode' );

    ==================

    There is one like this for the Rare checkbox, and another for the “Just Arrived” checkbox. = 3 files

    A fourth file in this directory displays a “Send Purchase Enquiry” button if and only if the Sold checkbox has been set to “on”.

    There is a 5th file in this includes dir, but this comes from Elementor, is called admin_functions.php and does only this (documentation at top file):
    `<?php
    /**
    * Hello Elementor admin functions.
    *
    * @package HelloElementor
    */

    /**
    * Show in WP Dashboard notice about the plugin is not activated.
    *
    * @return void
    */
    … their code here.

    Would my 4 files be causing the warning messages, in your opinion?

    Many thanks!
    SH