Double Curly Brackets in Php

时间:2020-04-30 作者:O.k

我在开发主题以达到较高的数组键和值时有以下代码。使用{{image about}}}访问附件数组第一个键“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\',
                    ),
                ),
            ]
    ]);
我找不到任何与双花括号有关的反应。仅查找wp。自定义javascript符号或角度。但是他们都没有解释这种情况。

任何有关这方面的信息都会很有帮助

1 个回复
最合适的回答,由SO网友:Jacob Peattie 整理而成

在您的示例中{{image-about}} 告诉WordPress使用中定义的图像[\'attachments\'][\'image-about\'] 作为“初学者内容”中这些帖子的缩略图。此功能特定于WordPress 4.7中添加的“初学者内容”功能,如下所述here, 而不是PHP语言功能。