Closed sahillangoo closed 2 years ago
You can add shortcuts in your manifest just like you add the screenshots, e.g.
add_filter(
'web_app_manifest',
static function ( $manifest ) {
$manifest['shortcuts'] = array(
array(
'name' => __( 'App Shortcut-1', 'text-domain' ),
'short_name' => __( 'Shortcut 1', 'text-domain' ),
'description' => __( 'Shortcut 1 description.', 'text-domain' ),
'url' => home_url( '/shortcut-1/?utm_source=pwa' ),
'icons' => array(
array(
'src' => 'https://example.com/shortcut-1.png',
'sizes' => '192x192',
),
),
),
array(
'name' => __( 'App Shortcut-2', 'text-domain' ),
'short_name' => __( 'Shortcut 2', 'text-domain' ),
'description' => __( 'Shortcut 2 description.', 'text-domain' ),
'url' => home_url( '/shortcut-2/?utm_source=pwa' ),
'icons' => array(
array(
'src' => 'https://example.com/shortcut-2.png',
'sizes' => '192x192',
),
),
),
);
return $manifest;
}
);
You can confirm your manifest output in the DevTools under Application > Manifest
or by visiting the route /wp-json/wp/v2/web-app-manifest
I have created the child theme for my website and have added some details which worked fine
and for arrays like icons
This works fine but how to add shortcuts? i.e array in array and output should be like this:
this throws error:
PS: Im open to suggestions!