Home › Forums › General Issues › Displaying Value of a Field › Reply To: Displaying Value of a Field
So sorry for the very late response. Here is my PHP Code
<div class="nk-slider-item <?php echo esc_attr( $active_class ); ?>" data-categories="<?php echo esc_attr( $categories ); ?>" data-background-position="<?php echo esc_attr( $position ); ?>">
<?php
echo '<img
src="' . esc_url( $image['src'] ) . '"
srcset="' . esc_attr( $image_small ? $image_small['src'] : $image['src'] ) . '"
data-srcset="' . esc_attr( $srcset ) . '"
data-sizes="auto"
alt="' . esc_attr( $item['title'] ) . '"
class="lazyload"
style="object-position: ' . esc_attr( $position ) . ';"
title="'?><?php echo $portfolio_title['value'] ?><?php echo'"
subtitle="'?><?php echo $portfolio_subtitle['value'] ?><?php echo'"
tagline="'?><?php echo $portfolio_tagline['value'] ?><?php echo'"
link="'?><?php echo $portfolio_link['value'] ?><?php echo'"
>';
if ( $video_url ) {
echo '<div data-bg-video="' . esc_attr( $video_url ) . '" data-bg-video-size="' . esc_attr( $video_size ? $video_size : '16x9' ) . '"></div>';
}
?>
</div>
And this is the ACP function
if( function_exists('acf_add_local_field_group') ):
// CUSTOM - Add Custom Theme Options
acf_add_local_field_group(array(
'key' => 'group_5d3483d4797b0',
'title' => 'Custom Portfolio Options',
'fields' => array(
array(
'key' => 'field_5d3489ae984d3',
'label' => 'Portfolio Options',
'name' => '',
'type' => 'tab',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'placement' => 'left',
'endpoint' => 0,
),
array(
'key' => 'field_5d3489d2984d4',
'label' => 'Add Titles and Link',
'name' => 'add_titles_and_link',
'type' => 'select',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'choices' => array(
'Yes' => 'Yes',
'No' => 'No',
),
'default_value' => array(
0 => 'No',
),
'allow_null' => 0,
'multiple' => 0,
'ui' => 0,
'return_format' => 'value',
'ajax' => 0,
'placeholder' => '',
),
array(
'key' => 'field_5d348410a77d1',
'label' => 'Title',
'name' => 'portfolio_title',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_5d3489d2984d4',
'operator' => '==',
'value' => 'Yes',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
array(
'key' => 'field_5d348433a77d2',
'label' => 'Subtitle',
'name' => 'portfolio_subtitle',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_5d3489d2984d4',
'operator' => '==',
'value' => 'Yes',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
array(
'key' => 'field_5d34843fa77d3',
'label' => 'Tagline',
'name' => 'portfolio_tagline',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_5d3489d2984d4',
'operator' => '==',
'value' => 'Yes',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
array(
'key' => 'field_5d348a42984d5',
'label' => 'Tagline Link',
'name' => 'tagline_link',
'type' => 'select',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_5d3489d2984d4',
'operator' => '==',
'value' => 'Yes',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'choices' => array(
'Yes' => 'Yes',
'No' => 'No',
),
'default_value' => array(
0 => 'No',
),
'allow_null' => 0,
'multiple' => 0,
'ui' => 0,
'return_format' => 'value',
'ajax' => 0,
'placeholder' => '',
),
array(
'key' => 'field_5d34844ea77d4',
'label' => 'Link',
'name' => 'portfolio_link',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_5d348a42984d5',
'operator' => '==',
'value' => 'Yes',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'portfolio',
),
),
),
'menu_order' => 10,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
));
acf_add_local_field_group(array(
'key' => 'group_5d3484b7e9e69',
'title' => 'Custom Theme Options',
'fields' => array(
array(
'key' => 'field_5d3487527b146',
'label' => 'Translate Options',
'name' => '',
'type' => 'tab',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'placement' => 'left',
'endpoint' => 0,
),
array(
'key' => 'field_5d3484efa4eca',
'label' => 'Translatable',
'name' => 'translatable',
'type' => 'select',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'choices' => array(
'Yes' => 'Yes',
'No' => 'No',
),
'default_value' => array(
0 => 'No',
),
'allow_null' => 0,
'multiple' => 0,
'ui' => 0,
'return_format' => 'value',
'ajax' => 0,
'placeholder' => '',
),
array(
'key' => 'field_5d3489189d192',
'label' => 'English Page',
'name' => 'english_page',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_5d3484efa4eca',
'operator' => '==',
'value' => 'Yes',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
array(
'key' => 'field_5d34892d9d193',
'label' => 'French Page',
'name' => 'french_page',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_5d3484efa4eca',
'operator' => '==',
'value' => 'Yes',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
array(
'key' => 'field_5d34893c9d194',
'label' => 'Spanish Page',
'name' => 'spanish_page',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_5d3484efa4eca',
'operator' => '==',
'value' => 'Yes',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
array(
'key' => 'field_5d34894c9d195',
'label' => 'German Page',
'name' => 'german_page',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_5d3484efa4eca',
'operator' => '==',
'value' => 'Yes',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'page',
),
),
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'post',
),
),
),
'menu_order' => 20,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
));
endif;
I have been able to echo successfully before, but I think this code is incorrect.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.