Support

Account

Home Forums General Issues if then statements with known field value

Solved

if then statements with known field value

  • I’m trying for an if than statement to setup a code that only changes my class if the test name has not been set yet. When I tried this code:

    <?php if (get_sub_field('session-title')="TBA") {
    		$sessionbgclass="";
    		}else{
    		$sessionbgclass=" dark";
    		};?>

    when i use this code i get this error:

    “Can’t use function return value in write context”

    What am I doing wrong?

  • i believe i figured it out.

    it works if i change the first line from:

    <?php if (get_sub_field('session-title')="TBA") {

    to

    <?php if (get_sub_field('session-title')=="TBA") {

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

The topic ‘if then statements with known field value’ is closed to new replies.