Closed pedro-mendonca closed 4 years ago
What you think about this? AFAIK this is the best what we can do. There are no actions nor filters to modify JavaScript templates which are used on themes page.
To achieve this I used wp_prepare_themes_for_js
and modified description
parameter. Something like this:
add_filter('wp_prepare_themes_for_js', function ($themes) {
foreach ($themes as &$theme) {
// we need to close description paragraph
$theme['description'] .= '</p>';
// we can omit closing paragraph tag
$theme['description'] .= '<p class="theme-update-translation"><a href="#">Update translation</a>';
}
return $themes;
});
@Dartui I'm sorry for delay to check! And thank you for suggesting code ❤️❤️❤️
Can you send me a pull request if I make add-theme-support
branch? Then I'll add a generated link to GlotPress :)
Update: I added a branch 😉 https://github.com/mayukojpn/force-update-translations/tree/add-theme-support
I've opened a ticket in core to add a few useful hooks on themes.php page. https://core.trac.wordpress.org/ticket/47650
If accepted, will allow to add action buttons and aditional info on the theme details panel.
If it's not accepted, than we can do the way @Dartui suggested above to include some more <p>
in the theme description.
The Update translation link might be added to the network themes list - hooked in theme_action_links.
For single site I didn't found any other action links hook, also can't think of a good place to insert the link, other than the theme details page.