I have below code when developing theme to reach upper array keys and value. Use {{image-about}} to reach attachments array first key 'image-about' => ...
add_theme_support( 'starter-content', [
'widgets' => [
// Place three core-defined widgets in the sidebar area
'ju_sidebar' => [
'text_business_info', 'search', 'text_about',
]
],
// Create the custom image attachments used as post thumbnails for pages
'attachments' => [
'image-about' => [
'post_title' => __('About','udemy'),
'file' => 'assets/images/about/1.jpg',
],
],
'posts' => [
'home' => [
'thumbnail' => '{{image-about}}'
],
'about' => [
'thumbnail' => '{{image-about}}'
],
'contact' => [
'thumbnail' => '{{image-about}}'
],
'blog' => [
'thumbnail' => '{{image-about}}'
],
'homepage-section' => [
'thumbnail' => '{{image-about}}'
],
],
'options' => [
'show_on_front' => 'page',
'page_on_front' => '{{home}}',
'page_for_posts' => '{{blog}}',
],
'theme_mods' => [
'ju_facebook_handle' => 'udemy',
'ju_twitter_handle' => 'udemy',
'ju_instagram_handle' => 'udemy',
'ju_email' => 'udemy',
'ju_phone_number' => 'udemy',
'ju_header_show_search' => 'yes',
'ju_header_show_cart' => 'yes',
],
'nav_menus' => [
'primary' => array(
'name' => __('Primary Menu','udemy'),
'items' => array(
'link_home',
'page_about',
'page_block',
'page_contact',
),
),
'secondary' => array(
'name' => __('Secondary Menu','udemy'),
'items' => array(
'link_home',
'page_about',
'page_block',
'page_contact',
),
),
]
]);
I couldn't find any response related to those double curly braces. Only find for wp.customize javascript notation or angular.js but none of them explains this situation.
Any information about that would be very helpful
I have below code when developing theme to reach upper array keys and value. Use {{image-about}} to reach attachments array first key 'image-about' => ...
add_theme_support( 'starter-content', [
'widgets' => [
// Place three core-defined widgets in the sidebar area
'ju_sidebar' => [
'text_business_info', 'search', 'text_about',
]
],
// Create the custom image attachments used as post thumbnails for pages
'attachments' => [
'image-about' => [
'post_title' => __('About','udemy'),
'file' => 'assets/images/about/1.jpg',
],
],
'posts' => [
'home' => [
'thumbnail' => '{{image-about}}'
],
'about' => [
'thumbnail' => '{{image-about}}'
],
'contact' => [
'thumbnail' => '{{image-about}}'
],
'blog' => [
'thumbnail' => '{{image-about}}'
],
'homepage-section' => [
'thumbnail' => '{{image-about}}'
],
],
'options' => [
'show_on_front' => 'page',
'page_on_front' => '{{home}}',
'page_for_posts' => '{{blog}}',
],
'theme_mods' => [
'ju_facebook_handle' => 'udemy',
'ju_twitter_handle' => 'udemy',
'ju_instagram_handle' => 'udemy',
'ju_email' => 'udemy',
'ju_phone_number' => 'udemy',
'ju_header_show_search' => 'yes',
'ju_header_show_cart' => 'yes',
],
'nav_menus' => [
'primary' => array(
'name' => __('Primary Menu','udemy'),
'items' => array(
'link_home',
'page_about',
'page_block',
'page_contact',
),
),
'secondary' => array(
'name' => __('Secondary Menu','udemy'),
'items' => array(
'link_home',
'page_about',
'page_block',
'page_contact',
),
),
]
]);
I couldn't find any response related to those double curly braces. Only find for wp.customize javascript notation or angular.js but none of them explains this situation.
Any information about that would be very helpful
Share Improve this question asked Apr 30, 2020 at 11:33 O.kO.k 34 bronze badges 2 |1 Answer
Reset to default 1In your example {{image-about}}
tells WordPress to use the image defined in ['attachments']['image-about']
as the thumbnail for those posts in the 'starter content'. This functionality is specific to the "Starter Content" feature added in WordPress 4.7, which is described here, and not a PHP language feature.
{{...}}
is placeholder text, meant to be replaced by some function or other, but your best bet is to check with Udemy's help streams. – Pat J Commented Apr 30, 2020 at 13:58