feat(share): align social sharing runtime
This commit is contained in:
@@ -424,26 +424,16 @@ trait ScriptsPart1c {
|
||||
}
|
||||
}
|
||||
|
||||
// Post/resource share functionality
|
||||
if (!empty($singular_assets['needs_share'])) {
|
||||
$weixin_share_path = get_template_directory() . '/assets/js/weixin-share.js';
|
||||
if (file_exists($weixin_share_path)) {
|
||||
// Reference-theme share runtime: direct platform links need no JS;
|
||||
// only poster generation is loaded when a share surface can render.
|
||||
if (!empty($singular_assets['needs_share']) || is_page_template('templates/pages/page-posts-navs.php')) {
|
||||
$poster_share_path = get_template_directory() . '/assets/js/poster-share.js';
|
||||
if (file_exists($poster_share_path)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-weixin-share',
|
||||
$base_uri . '/assets/js/weixin-share.js',
|
||||
['loader_js'],
|
||||
(string) filemtime($weixin_share_path),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$post_share_path = get_template_directory() . '/assets/js/post-share.js';
|
||||
if (file_exists($post_share_path)) {
|
||||
wp_enqueue_script(
|
||||
'aksrt-post-share',
|
||||
$base_uri . '/assets/js/post-share.js',
|
||||
['loader_js', 'aksrt-weixin-share', 'aksrt-share-data'],
|
||||
(string) filemtime($post_share_path),
|
||||
'aksrt-poster-share',
|
||||
$base_uri . '/assets/js/poster-share.js',
|
||||
['loader_js'],
|
||||
(string) filemtime($poster_share_path),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user