Inserting ‘featured articles’ ACF fields from other posts url= /posts/featured-articles    id= 35879
The objective: To insert ACF custom fields such as excerpts, texts, images, from Articles posts (sources) into the content of this Featured articles page (destination), in order to act as teasers and offer links back to the full articles.
The problem: In most cases the shortcodes contained within ACF custom fields in other posts (Articles) are NOT executed remotely. They get mixed up and process values from the equivalent custom fields found in this page.

Demo with a “mini-card” shortcode

The shortcode [ xyz-ihs snippet=”Cardframework1″] used in the column to the right is a mini-card builder. It calls ACF fields from the page to display images, title, layout groups of fields, id etc.

The fields purposely highlighted in red demonstrate how the field values from this page show up by error in the tests below, replacing the field values that should come from the source Article posts.

featured-articles: id= 35879

Featured articles ACF field ▷ Img1
Source field errors
None of the featured articles inserts should display the content from the ACF fields found in the destination page (highlighted in red here)

Exceptions: Grid based solutions such as Content Views or Beaver Builder insert Posts seem to handle the remote shortcode execution and rendering properly (see section 2b below). The challenge is to identify how to make the solution consistent ad pervasive across all types of inserts.

Inserting the fields from remote posts

The ACF fields “Featured” below are inserted using several methods:

  • 1/ Individual post inserts, using: | 1a A custom “featured” shortcode | 1b ACF shortcode | 1c Insert page plugin shortcode
  • 2/ Grid solutions filtering several posts in bulk and displaying them in page layouts: | 2a Content Views Pro grid plugin | 2b Beaver Builder: Insert posts

1a Using the custom “featured” shortcode proposed by Beaver Builder.

The custom shortcode [ featured id=’35400′ my_field=’featured’] allows to select a post ‘ id ‘ and ACF field name ‘ my_field ‘. (For reference, the custom code itself is in the functions.php of the child theme.).

The ACF field “acf_excerpt” from the PostArticle1 | id= 35400, designed with both Htmland Shortcodes,is inserted below:

[ featured id=’35400′ my_field=’acf_excerpt’]•

The ACF field “featured” from the PostArticle2 | id= 35406, designed with both Htmland Shortcodes,is inserted below:
[ featured id=’35406′ my_field=’featured’]

Conclusion: The shortcodes are identified inside the fields of their source posts, but end up processing the values from THIS destination page and its custom fields, NOT the ones from the source posts.
See the expected result in section 2b below. The grid solution works OK.

NOTE*:UNFORTUNATELY IF THE SAME SC IS INSERTED A SECOND TIME TARGETING THE my_field= “excerpt” [ featured id=’35400′ my_field=’acf_excerpt’], THE LINKS GET MIXED. EVEN FIELD “featured” PICKS UP FIELD “excerpt” INSTEAD.

Inserting ‘featured articles’ ACF fields from other posts