Support » Plugin: ACF Code Field » php not working

  • jenefer

    (@jenefer)


    Hi,
    I have two questions please. Is there anyway to stop the code box stretching across the whole screen on the admin side without adding breaks in the code?
    I have entered some php into the box and it just prints as text. This is the php

    $results = $wpdb->get_results(“SELECT utility_name FROM db_utility INNER JOIN ma_utility ON db_utility.utility_id=ma_utility.utility_id WHERE ma_utility.loc_id=$location AND db_utility.utility_group=’Fuel’ ORDER BY utility_name ASC”);

    Any ideas what I am doing wrong?
    Thanks

Viewing 1 replies (of 1 total)
  • Plugin Author ptasker

    (@ptasker)

    The reason the code is stretching the editor box like that is because it’s basically one long string. If you break it up or concatenate it, it could be broken to other other lines.

    As for outputting PHP, the code field doesn’t include any functionality to output the PHP contents with get_field(). You’ll have to handle that yourself, possibly using exec() or similar.

Viewing 1 replies (of 1 total)
  • The topic ‘php not working’ is closed to new replies.