CodeForGood
CodeForGood

Reputation: 749

WordPress: How to retrieve custom field data from the page?

I'm trying to retrieve the value from a Custom field as below. It doesn't seem to get any value. Please point out the mistakes in it.

<?php 
$gift_text_lines = get_sub_field( 'gift_text_lines' ); 
if ($gift_text_lines > 1) { ?>
    .fluentform .ff-el-image-holder {
        min-height: 264px;
        margin-bottom: 5px;
    }
<?php 
} 
?>

Custom fields are as seen in the image below.

enter image description here

Upvotes: 0

Views: 421

Answers (2)

Neal Developer
Neal Developer

Reputation: 595

Can you try get_field if get_sub_field not work for you.

if(in_array('hide_footer_signup_for', get_sub_field('gift_text_lines'))) 
{
        echo 'some html';
}

Upvotes: 1

Neal Developer
Neal Developer

Reputation: 595

You can try out :

$gift_text_lines = get_field( 'gift_text_lines' ); 

Upvotes: 1

Related Questions