php - Can't pick up a field created with Advanced Custom Fields -


i have situation where:

  • i need create custom link per image on image gallery. did via acf. have created text field html outputing hyperlinks converted automatically.
  • the user populating field link every time new post created.
  • i using custom post type (post-portfolio).
  • each post has cover image thumbnail when looking @ gallery.
  • those links later on displayed link on thumbnail of image - not on image's lightbox or single-post page.
  • the gallery's default behavior have 2 font-awesome icons acting buttons/links: lightbox view , single post permalink. have added new font awesome link/button have text field acting link's target.

the code on functions.php:

if(function_exists("register_field_group")) {     register_field_group(array (         'id' => 'acf_sponsorer-lank',         'title' => 'sponsor hyperlänk',         'fields' => array (             array (                 'key' => 'field_56ea5ece13165',                 'label' => 'sponsor länk till webbsida',                 'name' => 'sponsor_lank_till_webbsida',                 'type' => 'text',                 'instructions' => 'skriv här webbsidan till sponsorn. om det inte finns någon webbsida skriv endast #',                 'required' => 1,                 'default_value' => '',                 'placeholder' => '',                 'prepend' => '',                 'append' => '',                 'formatting' => 'html',                 'maxlength' => '',             ),         ),         'location' => array (             array (                 array (                     'param' => 'post_type',                     'operator' => '==',                     'value' => 'post-portfolio',                     'order_no' => 1,                     'group_no' => 1,                 ),             ),         ),         'options' => array (             'position' => 'normal',             'layout' => 'default',             'hide_on_screen' => array (             ),         ),         'menu_order' => 0,     )); } 

the code on gallery shows thumbnails:

$variable = get_field('sponsor_lank_till_webbsida', $post->post-portfolio);  <div class="acts">     <h3>'.get_the_title().'</h3>     <a href="'.$url.'" title="'.get_the_title().'" class="icon-search" rel="prettyphoto[gallery1]"><!----></a>     <a href="'.the_field('sponsor_lank_till_webbsida', get_option('acf_sponsorer-lank')).'" class=" icon-h-link" target="_blank"><!----></a> <!-- link problem -->     <a href="'.get_permalink().'" class=" icon-link"><!----></a> </div> 

a note on last bit of code wrote:

the <div class="acts"> inside of php tags, no need open , close there.

problem:

the custom field showing on custom post type page when admin creates new post, link on gallery page has no target (the value user inserts on post creation page).

i have been reading documentation , trying many times , many ways cannot seem make work. can please me?


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -